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.
| Framework | Example 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
| Field | Default | Meaning |
|---|---|---|
test_command | pytest | Your 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_day | null | Used for endpoints missing from traffic. Without it, those findings show no dollars. |
default_collection_size | 20 | Items per list response in production, used to scale per-item work measured in tests. |
endpoints.<key>.collection_size | — | Per-endpoint collection size. |
endpoints.<key>.list | false | Also scale response size to the collection size. |
n_plus_one_min_repeats | 3 | The same query from the same line this many times in one request is treated as per-item (N+1). |
cloud.region | us-east-1 | AWS region for prices. |
database.kind | rds_provisioned | rds_provisioned, aurora_io or none. |
database.monthly_cost | null | USD for your database instance(s). Needed to price query load on provisioned databases. |
database.vcpus / target_utilization | 2 / 0.7 | Capacity used to turn query time into dollars. |
database.current_utilization | null | Enables the “instance upsize likely” warning. |
database.ms_per_query | 0.3–1.5 | Production cost of a simple indexed query (low/high). |
logs.price_per_gb_ingested | price table | Override log ingestion price. |
egress.price_per_gb / external_fraction | price table / 1.0 | Override 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_call | 500 / 200 | Used when tests do not expose token usage. |
min_monthly_delta | 5 | Hide findings below this many USD/month. |
comment_on_no_change | false | Post a comment even when nothing significant changed. |
fail_above | null | Fail the check when the high estimate exceeds this many USD/month. The comment is posted first. |
base_install_command | null | Run in the base checkout before its tests, e.g. when dependencies changed. |
redact_sql | false | Send only query fingerprints, not generated SQL text. |