Can you set a hard spending limit on OpenRouter?
Yes, per key. Each API key can carry a credit limit in dollars, with an optional daily, weekly or monthly reset. Once it is spent, OpenRouter blocks the key's paid requests and the error's limit_source is openrouter_key_limit. Organizations can add guardrail and workspace budgets on top, which block paid requests with HTTP 403 once they are spent.
| Control | Applies to | What happens | Gap |
|---|---|---|---|
| Account credits | The whole account | Requests fail with HTTP 402 once the balance can't cover them | Every key draws on the same balance |
| Key credit limit | One key, with an optional daily, weekly or monthly reset | The key's paid requests are blocked once the limit is spent | Has to be set on each key in advance |
| Guardrail and workspace budgets | Members, keys or workspaces, set by an org admin | Paid requests fail with HTTP 403 once a budget is spent | Organizations only |
| Costbrake brake | One key, picked by your admin | Disables the key or drops its limit to $0 | Needs a management key |
A limit only stops spend at the number you picked, so a leaked key can spend its whole limit in one afternoon. Costbrake alerts you when an hour costs over 3 times its 7-day usual and at least $5 more, so you can act before the limit is reached. How to set a credit limit on an OpenRouter API key walks through the key settings.
What Costbrake reads from OpenRouter
With a management key, Costbrake reads the dollar counters OpenRouter keeps for every key in the account, so live spend is exact at each check; spend between two checks is spread evenly over those hours. The 60 busiest keys are tracked one by one and the rest shows as unattributed spend. It also reads billed spend per model for the last 30 completed UTC days, refreshed every 3 hours.
With a single API key, Costbrake sees only that key. Spend from other keys, from chat and from other workspaces is not counted, and earlier spend this month is added as daily totals so it doesn't look like a spike.
Which OpenRouter key does Costbrake need?
For every key in the account, a management key from Settings, Management keys on openrouter.ai. Management keys can't call OpenRouter's completion endpoints, and in an organization only Organization Admins can create one. OpenRouter shows the key once, so copy it straight into Costbrake.
To watch one app, paste the API key it already uses. That key can still spend credits, so keep a credit limit on it. A coding agent can connect it for you through agent setup: it checks the key against GET /api/v1/key without printing it and tells you if the key has no credit limit.
Brakes need a management key that can change API keys. You add it in the Costbrake dashboard when you turn on the killswitch, and Costbrake checks that it belongs to the same OpenRouter account as the connection.
How the OpenRouter brakes work
- An admin turns on the killswitch for the connection and adds the management key for brakes.
- Costbrake lists the account's keys with today's spend and current credit limit, busiest first.
- The admin picks a key and a brake, then types the connection's name to confirm.
- Costbrake updates the key at OpenRouter: disabled, or a credit limit of $0.
- Undo enables the key again, or puts back its earlier credit limit and removes the $0 one.
Costbrake refuses to disable a key that is already disabled or to cap one that already has a $0 limit, and it never deletes a key.
What Costbrake can't do on OpenRouter
- Stop spend on its own. Alerts are automatic; a brake always waits for an admin.
- Brake a connection that watches a single API key. That needs a management key.
- Stop free-model requests with the $0 credit limit.
- Change your account credits, guardrails or workspace budgets.
If a key has leaked, disable it first and rotate it after: What to do in the first hour after an API key leaks. For how OpenRouter prices requests, see What does OpenRouter charge on top of model prices?.
Questions and answers
Can I connect OpenRouter with a normal API key?
Yes. Costbrake then watches only that key's spend, not other keys, chat or other workspaces, and the connection has no brakes. To watch every key or use brakes, connect a management key instead.
Does Costbrake stop OpenRouter spend on its own?
No. Costbrake sends alerts automatically, but a brake only runs when an admin of your Costbrake workspace picks a key and types the connection name to confirm.
What happens after the $0 credit limit brake?
The key stays enabled, but OpenRouter blocks its paid requests because its credit limit is spent; the error's limit_source is openrouter_key_limit. Free models keep working, and Undo restores the earlier limit or removes the limit if there was none.
What does a disabled OpenRouter key return?
HTTP 401. OpenRouter uses 401 for invalid credentials, which covers disabled and invalid API keys. Undo in Costbrake enables the key again with its settings unchanged.
How often does Costbrake check OpenRouter spend?
Every 5 minutes on Pro and Team, every minute for 2 hours after a spike alert, and every hour on Free. Each check reads OpenRouter's own dollar counters, so the amount is exact at that moment.
Sources
Updated