OpenRouter Key Credit Check
A minimal VS Code extension that shows your credit remaining for an
OpenRouter API key in the status bar — and stores the key securely via VS Code's
SecretStorage (the OS credential store / keychain), not in plain text.

Depending on the key and your settings, it picks one of three display modes:
| Mode |
When it applies |
What it shows |
| Unlimited |
key has no cap of its own and limit is 0 (default) |
your account-wide credit balance (total credits − total usage), no cap, no reset |
| Manual |
key has no cap of its own and limit is set |
limit − usage for the period, resetting daily/weekly/monthly/never |
| Auto |
the key has its own credit limit |
the key's limit_remaining / limit, resetting per the key's settings |
Why this exists: OpenRouter's /api/v1/key endpoint returns only the key's
overall credit limit (limit/limit_remaining, often null if the key has
no cap) plus today's spend (usage_daily). It does not expose a
guardrail cap value. If your key has no overall limit but you set a guardrail
in the dashboard, no stock extension can read that cap. This extension instead
lets you set a local limit (with a daily/weekly/monthly reset
period) and computes limit − usage live, including BYOK spend.
Features
- Three display modes — auto (the key's own limit), manual (a local limit), or unlimited (account balance).
- Status bar shows
OR $X.XX/xxx — remaining over your limit (compact denominator).
- Secure storage — API key kept in VS Code
SecretStorage (OS keychain).
- Auto-refresh on a configurable interval (default 5 min, clamped to 1–1440).
- Exhausted highlighting — the status bar turns error-red at $0.00
remaining, and the panel's remaining figure turns red too.
- Configurable reset period — daily, weekly, monthly, or never.
- BYOK included — bring-your-own-key spend counts toward the guardrail.
Usage
Click the status bar item (bottom-right) to open the panel, paste your
sk-or-v1-... API key there, and — if the key has no cap of its own — set a
local limit to track usage with a daily/weekly/monthly/never reset.
The status bar shows OR $X.XX/xxx: remaining over the key's own limit (auto),
over your local limit (manual), or the account-wide balance OR $X.XX
(unlimited) when no limit is set.
Configuration
| Setting |
Default |
Description |
openrouterCreditCheck.limit |
0 |
Local cap in USD — shown as your limit when the key has no cap of its own. 0 disables the guardrail and shows the account-wide credit balance instead. |
openrouterCreditCheck.resetPeriod |
daily |
Guardrail reset cadence: daily / weekly / monthly / never. |
openrouterCreditCheck.includeByok |
true |
Count bring-your-own-key (BYOK) spend toward the guardrail. |
openrouterCreditCheck.refreshIntervalMinutes |
5 |
Refresh interval (clamped to 1–1440 minutes). |
openrouterCreditCheck.baseUrl |
https://openrouter.ai |
Advanced override. https-only and application-scoped: workspace overrides are ignored so a project cannot redirect your key to another host. |
All five settings are application-scoped (user/global only): workspace
.vscode/settings.json overrides are ignored, so opening a project can never
disable the guardrail, inflate it, or redirect the stored key.
Note: the local limit is a display/alert helper. OpenRouter's
server-side guardrail still enforces the real spending cap; this extension only
reports how close you are to your own limit.