GET /v1/balance endpoint. The
same information is available on every response via headers, and
in finer detail via the management API. This page documents the three
canonical paths.
1. Inline on every response (cheapest)
Every gateway response (success and failure) carries the quota envelope:| Header | What it means |
|---|---|
X-RateLimit-Limit / Remaining / Reset | The rate-limit bucket closest to constraining you (in USD; reset is Unix). |
X-Quota-Remaining-Credits | Lifetime remaining on this key (USD). |
X-Org-Quota-Remaining-Credits | Org wallet balance (org-owned keys only). |
X-Quota-Remaining-Credits. Polling
purely for balance is wasteful — just read these headers off the
real traffic.
2. Just my account: GET /api/v1/me/account
A free read-only management call that returns your user / org context
including current balance.
/api/v1/me/account for the
full response shape.
3. Per-call cost: GET /api/v1/me/usage
If you need exact credits charged per request, query the usage log:
prompt_tokens, completion_tokens, credits, the
model, and timestamps. See
/api/v1/me/usage for filters +
pagination.
4. Billing history: GET /api/v1/me/billing/transactions
Top-ups, refunds, and adjustments — every wallet movement that wasn’t
an API request. See
/api/v1/me/billing/transactions.
When to use which
| Need | Use |
|---|---|
| ”Do I have budget for this call?” | The X-Quota-Remaining-Credits header from a recent response — already free, no extra request. |
| ”Show org balance in my dashboard” | /api/v1/me/account — single call, includes org context. |
| ”Reconcile billing for a request id” | /api/v1/me/usage?request_id=... — exact credits per call. |
| ”What top-ups happened this month?” | /api/v1/me/billing/transactions. |
Why no /v1/balance?
Two reasons:
- Every response already carries the data you’d put in a balance endpoint. A dedicated endpoint would be a duplicate read against the same backend.
- The management API (
/api/v1/me/*) lives behind cookie-or-key auth and gives a richer picture than a raw balance number — org context, per-key spend, billing history.
/api/v1/me/account and read .balance from the
response.