How to get your OpenRouter API usage, balance and spend programmatically
What the OpenRouter API exposes
| Signal | OpenRouter |
|---|---|
| Balance | Yes. GET /api/v1/credits (account-wide; inference or management key) |
| Spend history | Yes. GET /api/v1/keys (management key: per-key usage_daily, usage_monthly) |
| Cost breakdown | No |
| Plan and quota | Yes |
| Cost on each response | Yes, the exact USD |
| Rate-limit headers | X-RateLimit-Limit, X-RateLimit-Remaining |
| Credential | Inference key, Management key (optional, for per-key spend) |
| Key permission | A management key is broad: it can create and delete keys and read account-wide data. Use a dedicated one you can revoke. An inference key needs no extra permission. |
Call it yourself
Credential. An inference key gives the account balance and the key's own usage. A management key (OpenRouter settings, then Management keys) also lists per-key usage. It can create and delete keys, so make a dedicated one for monitoring.
Balance
curl https://openrouter.ai/api/v1/credits \ -H "Authorization: Bearer $OPENROUTER_API_KEY"
{ "data": { "total_credits": 150, "total_usage": 53.28 } }Trimmed to the fields Argus reads. Values are examples.
Key usage and limit
curl https://openrouter.ai/api/v1/key \ -H "Authorization: Bearer $OPENROUTER_API_KEY"
{
"data": {
"label": "sk-or-v1-a1b…",
"usage": 53.28,
"usage_daily": 4.12,
"limit": null,
"limit_remaining": null,
"is_free_tier": false
}
}Trimmed to the fields Argus reads. Values are examples.
Per-key spend (management key)
curl https://openrouter.ai/api/v1/keys \ -H "Authorization: Bearer $OPENROUTER_MANAGEMENT_KEY"
{
"data": [
{
"hash": "…",
"name": "bearscan",
"label": "sk-or-v1-a1b…",
"usage": 1.757,
"usage_daily": 0.129,
"usage_weekly": 0.821,
"usage_monthly": 1.757
}
]
}Trimmed to the fields Argus reads. Values are examples.
Gotchas
- Every completion response carries usage.cost, the exact USD for that call, including on streamed responses. It's the most precise per-call cost any LLM provider gives you.
- Balance can dip slightly negative because settlement is async. Requests return 402 until you top up above zero.
- OpenRouter charges at each upstream provider's list price; its fee is on the credit purchase (5.5% card, 5% crypto), not per token.
- With an inference key there's no spend series to poll. Burn comes from the balance series after you connect, and the day's total is checked against usage_daily on /key.
- With a management key, month-to-date spend is the chosen key's usage_monthly, so it's right from the first read. Management keys can't make completion calls.
- GET /api/v1/activity covers every key and workspace on the account and can't be filtered to one key, so Argus doesn't use it for a single project's spend.
How OpenRouter charges
Prepaid credits, billed at each upstream provider's list price with no per-token markup — OpenRouter's fee is on the credit purchase (5.5% card, 5% crypto).
Free allowance. 50 a day. Free :free model variants.
At zero. Balance can go slightly negative (async settle); 402 until topped up above zero.
- 1,000 requests per day, per key. Paid usage is bounded by credit balance + upstream capacity, not RPM.
Or let Argus track it
Paste the key once. Argus keeps the ledger, and your coding agent reads it through the MCP server.
- Reads the OpenRouter balance every hour and keeps the series, so you get burn per day (top-ups never count as negative spend) and days until it hits zero.
- Pulls OpenRouter's daily cost buckets every hour for month-to-date spend and a projected month-end total.
- Tracks the plan: the allowance, what's used this period, the reset date, and when you cross into overage.
- With the SDK, records the cost OpenRouter reports on each response, so every call is itemized at its exact price.
- Reconciles itemized cost against OpenRouter's own daily total and flags drift, so you know whether the number is exact or an estimate.
- Emails you on low balance, days to zero, a spend spike, or projected overage.
- Hands all of it to your coding agent over MCP, so it can ask what a run cost or how much runway is left without leaving the editor.
> what has openrouter cost today, and how long until it runs out?
get_overview → openrouter: mtd spend, burn per day, days to zero
get_request_costs { "provider": "openrouter", "limit": 25 }
get_advisories → credits_low, spend_spike, rate_limit_low …Questions
- Does OpenRouter have an API for its balance?
- Yes. GET /api/v1/credits returns total_credits and total_usage; your balance is the difference, and credits are 1:1 with USD. That balance is account-wide. To see one key's spend, a management key can read that key's usage_daily, usage_weekly and usage_monthly from GET /api/v1/keys.
- Can I get OpenRouter spend per day from the API?
- Yes, from GET /api/v1/keys (management key: per-key usage_daily, usage_monthly), in daily buckets.
- What happens when OpenRouter credits run out?
- Balance can go slightly negative (async settle); 402 until topped up above zero. Auto-recharge is available.
- What key does Argus need for OpenRouter?
- An inference key gives the account balance and the key's own usage. A management key (OpenRouter settings, then Management keys) also lists per-key usage. It can create and delete keys, so make a dedicated one for monitoring.
Related
Give Claude Code, Cursor or Codex a read-only view of every metered API you build with, so it can check what a run cost, spot a leak, and notice a provider running dry.
What each provider actually exposes over its API, how to put balances, daily spend and plan quotas on one ledger, and where you'll have to estimate.
A runaway loop, a forgotten cron, a retry storm: how to find the call that's draining a balance, from the burn rate down to the endpoint.
What each console's own alerts do, what they can't see, and how to alert on days of runway left instead of a dollar threshold.
The balance call for each provider, side by side.
Pricing and limits verified 2026-10-21 against openrouter.ai/pricing, openrouter.ai/docs/limits, openrouter.ai/docs/guides/overview/auth/management-api-keys. Endpoints are the ones the Argus OpenRouter connector calls.
Connect a provider key, point Claude Code or Cursor at the Argus MCP server, and ask what the last run cost.