MergeCost

Configuration

.mergecost.yml lives at your repository root. Every field is optional; automatic setup creates a starter file.

Endpoint keys

Keys are "METHOD route-template" in your framework’s own route syntax. A route without a method applies to every method.

FrameworkExample key
Django / DRF"GET api/posts/<int:pk>/"
FastAPI / Starlette"GET /posts/{post_id}"
Flask"GET /posts/<int:post_id>"
Express / Fastify / NestJS"GET /posts/:id"
Celery task"TASK app.tasks.send_email" (value = runs per day)

Example

version: 1
test_command: "pytest -q"
traffic:
  "GET /feed": 200000
  "POST /orders": 8000
default_requests_per_day: 10000
default_collection_size: 20
endpoints:
  "GET /feed":
    collection_size: 50
    list: true
database:
  kind: rds_provisioned
  monthly_cost: 1200
  vcpus: 4
external_apis:
  "maps.googleapis.com": 0.005
min_monthly_delta: 5
fail_above: 500

All settings

FieldDefaultMeaning
test_commandpytestYour test command. MergeCost adds its own flags for pytest and sets MERGECOST* environment variables for every runner.
traffic{}Requests per day per endpoint key.
default_requests_per_daynullUsed for endpoints missing from traffic. Without it, those findings show no dollars.
default_collection_size20Items per list response in production, used to scale per-item work measured in tests.
endpoints.<key>.collection_size—Per-endpoint collection size.
endpoints.<key>.listfalseAlso scale response size to the collection size.
n_plus_one_min_repeats3The same query from the same line this many times in one request is treated as per-item (N+1).
cloud.regionus-east-1AWS region for prices.
database.kindrds_provisionedrds_provisioned, aurora_io or none.
database.monthly_costnullUSD for your database instance(s). Needed to price query load on provisioned databases.
database.vcpus / target_utilization2 / 0.7Capacity used to turn query time into dollars.
database.current_utilizationnullEnables the “instance upsize likely” warning.
database.ms_per_query0.3–1.5Production cost of a simple indexed query (low/high).
logs.price_per_gb_ingestedprice tableOverride log ingestion price.
egress.price_per_gb / external_fractionprice table / 1.0Override egress price; share of response bytes leaving AWS.
external_apis{}USD per call by host.
llm.prices_per_million{}Override per "provider/model": {input: X, output: Y}.
llm.default_tokens_per_call500 / 200Used when tests do not expose token usage.
min_monthly_delta5Hide findings below this many USD/month.
comment_on_no_changefalsePost a comment even when nothing significant changed.
fail_abovenullFail the check when the high estimate exceeds this many USD/month. The comment is posted first.
base_install_commandnullRun in the base checkout before its tests, e.g. when dependencies changed.
redact_sqlfalseSend only query fingerprints, not generated SQL text.