OpenRouter integration

OpenRouter spend alerts and brakes

Costbrake reads OpenRouter's dollar counters for each API key every 5 minutes on Pro and Team, and every minute for 2 hours after a spike alert. Connected with a management key, it can disable a key or set its credit limit to $0, and Undo puts the key back the way it was.

You can also connect the one API key your app uses: Costbrake then watches only that key and has no brakes. The Free plan checks hourly by email; brakes come with Pro at $12 a month and Team at $39 a month (see pricing), and an admin starts every brake by hand.

OpenRouter at a glance

Reads
Dollar counters per key, plus billed spend per model per day with a management key
Key
A management key, or one API key; brakes need a management key that can change keys
Setup
Paste the key on the connect page; a coding agent can connect the API key your app already uses
Free plan
Checks every hour, email alerts, no brakes
Pro and Team
Checks every 5 minutes, Slack, Discord and webhook alerts, brakes
Spike checks
Every minute for 2 hours after a spike alert
Brakes
Disable API key, Set credit limit to $0

Brakes

2 brakes for OpenRouter

An admin picks a brake, confirms it, and can undo it later. Brakes come with Pro and Team.

  • Admin confirms

    Disable API key

    Disables the API key, so every request made with it fails with HTTP 401; other keys keep working.

    UndoEnables the API key again.

    Every other key in the account keeps working and spending, so brake each key a runaway job can reach.

  • Admin confirms

    Set credit limit to $0

    Sets the key's credit limit to $0, so its paid requests fail while the key stays enabled.

    UndoRestores the credit limit the key had before, or removes it if it had none.

    Requests to free models keep working with the key.

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.

ControlApplies toWhat happensGap
Account creditsThe whole accountRequests fail with HTTP 402 once the balance can't cover themEvery key draws on the same balance
Key credit limitOne key, with an optional daily, weekly or monthly resetThe key's paid requests are blocked once the limit is spentHas to be set on each key in advance
Guardrail and workspace budgetsMembers, keys or workspaces, set by an org adminPaid requests fail with HTTP 403 once a budget is spentOrganizations only
Costbrake brakeOne key, picked by your adminDisables the key or drops its limit to $0Needs 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

  1. An admin turns on the killswitch for the connection and adds the management key for brakes.
  2. Costbrake lists the account's keys with today's spend and current credit limit, busiest first.
  3. The admin picks a key and a brake, then types the connection's name to confirm.
  4. Costbrake updates the key at OpenRouter: disabled, or a credit limit of $0.
  5. 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

Start with 14 days of Pro, free

Catch the next OpenRouter spike before the invoice.

14 days of Pro, then Free for 2 accounts. No card needed.