OneProvider
API reference

Usage & billing

Understand your bill: usage in every response, a balance endpoint for each key, effective rates, 429 rate limits and what an empty balance does.

Per-request usage ships in every response — bill from it with confidence. Balance snapshot available via GET /v1/dashboard/balance.

All models, capabilities, and prices Documentation index for AI agents: https://oneprovider.dev/docs/llms.txt

Per-request usage

Every /v1/messages response includes a usage object with token counts:

json
{
"usage": {
"input_tokens": 48,
"output_tokens": 92,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}

For chat-completions , the same numbers appear as prompt_tokens, completion_tokens and total_tokens.

Key balance: GET /v1/dashboard/balance

Returns the key's current balance. It answers instantly and takes the same key as the API.

Authorization: Bearer Send your key in the Authorization: Bearer sk-... header, like OpenAI-style balance clients do. x-api-key works on this endpoint too. bash
curl -H "Authorization: Bearer sk-YOUR_KEY_HERE" \
https://api.oneprovider.dev/v1/dashboard/balance

Response 200 OK:

json
{
"object": "balance",
"balance_usd": 54.77,
"expires_at": "2027-01-29T19:00:00Z",
"is_active": true,
"last_synced_at": "2026-11-16T19:52:00Z"
}
  • balance_usd: the key's available balance in USD.
  • expires_at: key expiry (ISO 8601 UTC, null if there is none).
  • is_active: false if the key is paused or disabled.
  • last_synced_at: when the balance was last updated.

OpenAI-compatible balance endpoints

Apps such as NextChat and LobeChat read the balance from OpenAI-style paths. These work with the same key in Authorization: Bearer:

Reference data
EndpointWhat it returns
GET /v1/dashboard/billing/subscriptionhard_limit_usd: remaining balance
GET /v1/dashboard/billing/usagetotal_usage: always 0 (the field is in cents)
GET /v1/dashboard/billing/credit_grantstotal_available: remaining balance

Errors: 401 for a missing or invalid Authorization: Bearer header; 429 when you exceed the rate limit (balance endpoints are limited per IP). Balance and per-request spend are also in the cabinet (the “Usage” page in the @oneprovider_robot bot and at app.oneprovider.dev ).

Effective rates

We bill flat per-1M tokens at the rate published on /pricing . There is no minimum, no rounding. The math is:

text
cost = (input_tokens / 1_000_000) * rate_in
+ (output_tokens / 1_000_000) * rate_out
+ (cache_read_input_tokens / 1_000_000) * rate_cache_read
+ (cache_creation_input_tokens / 1_000_000) * rate_cache_write
  • Cache reads are billed at 10% of the input rate or less, depending on the model.
  • Cache creation (the first time a cache breakpoint is written) is billed at 125% of the input rate for a 5-minute cache and 200% for a 1-hour cache, on models that offer one.
  • rate_cache_read and rate_cache_write are the model's own cache rates: they are listed per model in the models table .

When the balance runs out

Once the key's balance reaches zero, requests with it return 429 with error.type insufficient_balance, error.code insufficient_quota, and the header x-should-retry: false:

http
HTTP/1.1 429 Too Many Requests
x-should-retry: false
Content-Type: application/json
{
"type": "error",
"error": {
"type": "insufficient_balance",
"code": "insufficient_quota",
"message": "Insufficient balance on this API key. Top up: dashboard.oneprovider.dev"
}
}

Do not retry: check the cabinet balance and the key’s limit (the “Keys” page), top up the cabinet if needed, and send the request again (how ). Every other code is covered in Error codes .

You set the key term; balance does not expire You set a key’s term in the cabinet (up to 90 days, extendable). The balance is not debited by a timer: there is no monthly reset, commit, or subscription; funds remain available until they are spent.

Rate-limit (429)

Too many requests in a short time return 429 rate_limit_error. The response may carry a Retry-After header in seconds:

http
HTTP/1.1 429 Too Many Requests
Retry-After: 2
Content-Type: application/json
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Rate limit exceeded; retry later"
}
}

When Retry-After is present, wait at least that long; otherwise retry with a growing pause. If 429s keep coming, lower client-side concurrency. Rate-limited requests do not consume balance.

Per-request usage accuracy

Per-request usage objects sum exactly to the real per-key spend. Verified 2026-05-08 across a 24h sample of 25 845 requests: max delta was <$0.001 (rounding at the 6th decimal). Bill from the per-request usage with confidence.

Last updated: 2026-11-28 Found a bug? @Oneproviderhelpbot