How to get your OpenRouter API usage, balance and spend programmatically
What the OpenRouter API exposes
| Signal | OpenRouter |
|---|---|
| Balance | Yes. GET /api/v1/credits (management key) |
| Spend history | No |
| 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 | API key |
Call it yourself
Credential. An OpenRouter API key. OpenRouter documents /credits under its management keys, so use one of those if a regular key is refused.
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.
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.
- There's no daily spend series Argus polls. Burn comes from the balance series, and the day's total is checked against usage_daily on /key.
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.
- 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. GET /api/v1/key returns the key's own usage, limit and free-tier flag.
- Can I get OpenRouter spend per day from the API?
- Not as a series. Each response reports its own cost, so sum it per day yourself, or let Argus do it.
- 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 OpenRouter API key. OpenRouter documents /credits under its management keys, so use one of those if a regular key is refused.
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-07-20 against openrouter.ai/pricing, openrouter.ai/docs/limits. 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.