Tera Router
Concepts

Plans, Budgets & Pricing

Per-key limit templates, budgets with hard cutoffs, and model pricing.

Plans — limit templates

A plan is a bundle of limits that can be bound to many keys at once. Every limit applies to each key on its own: two keys on a $50 plan can each spend $50.

  • budget_spend — cost limit (USD) per period.
  • budget_tokens — token limit per period.
  • period — daily, weekly, or monthly.
  • alert_at_percent — usage percentage at which the Plans page marks a key amber (red once the cap is spent).
  • hard_cutoff — whether the limit actually blocks or only warns.
  • allowed_models — model allowlist for every key on this plan.
  • rpm, tpm, concurrent — requests per minute, tokens per minute, and requests in flight per key. Enforced while Enforce API key rate limits (Settings → Network) is on; a request over a limit gets 429 with Retry-After. TPM counts the tokens of the key's finished requests in the last minute. Counters live in the server process, so each instance enforces its own.

The Default plan is created automatically during seeding. Manage plans from the Plans page.

Budgets — per-scope monitoring

Budgets operate at three scopes, and each counts only its own traffic: tenant (every request), api_key (requests made with that key), and account (requests served by that provider account). An exceeded tenant or api_key budget with hard_cutoff answers 402. An exceeded account budget with hard_cutoff takes that account out of routing until the period resets, so the request falls back to the provider's other accounts or the next target. Budgets without hard_cutoff only alert. Token caps count tokens scaled by the model's token consumption rate. A limit counts recorded usage plus the prompts of requests still in flight, so a burst of concurrent requests cannot all pass a limit together; a request's own output is only counted once it finishes.

curl -X POST http://localhost:8080/v1/budgets \
  -H "Authorization: Bearer <dashboard-jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "scope_kind": "api_key",
    "scope_id": "<key-id>",
    "budget_spend": 25,
    "period": "monthly",
    "alert_pct": 80,
    "hard_cutoff": true
  }'

Running usage is visible via GET /v1/budgets/status or the Quota Tracker page — including spend and token percentages against the limits. A budget that's taking a break can be paused from Quota Tracker without being deleted.

Model pricing

Cost is computed from a per-million-token price table: input, output, cache read, and cache write. Default prices come from provider snapshots, and can be overridden per model via pricing overrides (Plans page or the model-pricing-overrides API).

Models without a price are counted as zero — if the spend numbers on Usage feel too small, first check whether the models you use actually have prices.

On this page