Guides

Control spend

Pin service tiers, cap spend per key, and attribute cost to features.

Service tiers

Most providers sell the same model at more than one tier. Pin one as the third segment of a candidate:

openai:gpt-5.4-mini:flex
fireworks:accounts/fireworks/models/kimi-k2p7-code:priority

Supported values differ by provider, and not every model offers every tier:

ProviderService tiers
OpenAIauto, default, flex, priority
Fireworksdefault, priority

Flex costs less but its latency is higher and less predictable. Rather than pinning it, you can let Router pick between standard and Flex per request — see Cost-efficient routing.

Spend caps

Each API key can carry a lifetime spend cap. Once recorded usage exceeds it, Router stops the key and further requests fail with 401: a lifetime cap disables the key (api_key_deactivated, with the cap as the reason), and a recurring cap locks it until the period ends (invalid_api_key). Neither returns 402, which means the account is out of credit.

Caps are per key, not per request, so give each application, environment, or team its own key when they need independent limits. You can also:

  • Lock a key to disable it while keeping it for later.
  • Unlock an eligible key to re-enable it.
  • Revoke a key to delete the credential permanently.

Key changes take a few seconds to apply.

Track spend by feature

Add short, stable labels to the standard Responses metadata field:

{
  "model": "your-model-id",
  "input": "Summarize this support case.",
  "metadata": {
    "feature": "support-summary",
    "team": "customer-operations",
    "environment": "production"
  }
}

Router stores them with the usage record and shows them in the request detail under Request metadata.