Usage and billing
Read token usage and reconcile a request with the model’s tariff.
Request and concurrency limits
The API gateway uses a 60-second window with no separate per-second quota. Keys belonging to the same customer share the allowance. Each model request, token count or MCP tool call that reaches this check consumes one slot in the minute’s allowance.
| Field | Meaning |
|---|---|
One customer | 30 requests per minute · up to 10 new requests in flight. An open stream occupies one slot. |
Shared gateway | 120 requests per minute · up to 64 new requests in flight across customers. Model capacity may be lower. |
GET /v1/credits | Separate limit of 60 balance reads per minute per key. Model catalog reads are outside the model request quota. |
On HTTP 429, wait for Retry-After when present. For concurrency_limit, finish an active request before retrying.
What happens to my balance on error?
A request rejected before it is sent to the model incurs no model charge. A confirmed model rejection such as a rate limit releases the reservation. If the connection breaks or times out after dispatch, usage may already have occurred. Confirmed tokens are billed, including tokens used by a stream that ends early. If usage is unknown, the reservation can remain pending. A pending amount reduces available credit while the charge is unresolved.
Find the X-Request-Id in your usage history or give it to support. For supported endpoints, retry with the same idempotency key and request body.
Before adding funds
You can add USD credit with crypto, starting at $5. Your wallet lists the supported coins and networks. Unused credit has no automatic expiry. Crypto top-ups are non-refundable except where required by law. Balance and refund terms · Estimate a request · Service status.
Check which model served the request
X-Kavren-Model: deepseek-v4.1-flash-fast
X-Request-Id: 123e4567-e89b-42d3-a456-426614174000Set an optional fallback in the API key settings. When capacity is unavailable, a permitted fallback must fit the context, output limit and selected effort. Each of its three token prices must be no higher. A successful switch returns X-Kavren-Model. Match X-Request-Id against the usage ledger. Embeddings always use the requested model so that vectors stay comparable.
Read the token counts
{
"usage": {
"prompt_tokens": 1200,
"prompt_tokens_details": {
"cached_tokens": 800
},
"completion_tokens": 200,
"total_tokens": 1400
}
}Here 400 input tokens are uncached, 800 input tokens are cached and 200 are output. The cached count is already included in prompt_tokens.
Calculate the charge
Take the three prices in USD per million tokens from the model tariff. For the usage above, the charge before rounding is:
(400 × input_rate + 800 × cached_rate + 200 × output_rate) / 1,000,000Why a small request can return 402
Before generation, Kavren checks available credit against a reservation based on the model’s context window and requested output limit. Concurrent requests can hold credit at the same time. Usage is settled from the reported tokens. Reduce the output limit or choose a lower-priced model if the reservation exceeds your available balance.