Docs · Routes and pricing
How requests are billed
Billing units, long-context tiers, the up-front reservation and what happens to it when a request fails.
Every request is priced from one fixed USD tariff: the model on your key's route, as on the Models page (Auto route keys pay the route picked per request). The tariff is captured before forwarding; later price edits never touch a request in flight. A model with no price on your route is refused with HTTP 400 invalid_request, "model ... has no configured USD price for this API key route".
Units
Text models bill per million tokens, one price per lane: input, output, cache read and cache write (Claude also prices a 1-hour cache write). On OpenAI and Kimi models the relay does not forward a cache TTL, neither the one in prompt_cache_options nor one set on a single prompt_cache_breakpoint in input, so every cache write is the default kind and bills at the listed cache-write price. Cached tokens are not regular input; a lane with no price of its own bills as input. Jev bills input only, output $0.
Image models bill per image: 1k (up to 1024x1024) or 2k (up to 2048x2048). An omitted or auto size is pinned to 1024x1024; a larger output than requested settles at its class. Both gpt-image-2.5-* models cost $0.03 per 1K image and $0.05 per 2K, times n.
grok-imagine-video-1.5 bills per second: $0.05 at 480p (default), $0.10 at 720p, $0.20 at 1080p, for 1 to 15 seconds (default 8).
Worked example: repeated Claude input
This is a reproducible estimate, not a customer bill or a measured cache-hit rate. Prices were checked on 2026-10-28 in the public price table: claude-sonnet-5-5 on claude-shared, USD per million tokens, $1 input, $5 output, $0.05 cache read and $1.25 for a 5-minute cache write. Use the model page for today's tariff.
Assume three direct Messages API requests share an identical 20,000-token prefix. Each also has 2,000 uncached input tokens and 1,000 output tokens. The first writes the prefix to a 5-minute cache; the next two arrive while it is valid and each reports a full cache hit. No 1-hour write, media charge or hosted MCP surcharge is included.
| Request | Uncached input | Cache write | Cache read | Output | Estimated charge |
|---|---|---|---|---|---|
| First | 2,000 × $1 / 1M = $0.002 | 20,000 × $1.25 / 1M = $0.025 | 0 | 1,000 × $5 / 1M = $0.005 | $0.032 |
| Second | $0.002 | 0 | 20,000 × $0.05 / 1M = $0.001 | $0.005 | $0.008 |
| Third | $0.002 | 0 | $0.001 | $0.005 | $0.008 |
| Total | $0.006 | $0.025 | $0.002 | $0.015 | $0.048 |
Without caching, the same quantities cost 3 × (22,000 × $1 + 1,000 × $5) / 1,000,000 = $0.081. The difference in this scenario is $0.033. Cache expiry, a changed prefix, a different model or route, a 1-hour write, and additional provider-reported tokens change the result. Cache reads and writes are separate input categories, not an extra charge on top of the same uncached tokens.
For a real request, open Billing Details in the usage log. Use its captured tariff, exclusive token quantities, rounding adjustment and Wallet charged, rather than repricing an old request with today's table. The price calculator estimates workloads across models and routes; it does not guarantee cache hits.
Long-context tiers
OpenAI and Grok models carry a long-prompt tariff: once total input context (prompt plus cache tokens) reaches 272,001 tokens (gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra) or 200,000 tokens (grok-4.7), the whole request settles at the long lanes, not just the excess. Claude, Kimi, GLM and Jev have no tier; the tier is decided at settlement.
Historical peak-hour charges
deepseek-v4-pro retired on 2026-10-25. Its historical usage logs retain the peak or off-peak tier and prices captured when each request was accepted. Retirement does not recalculate past charges.
The private deployment deepseek-flash-Abliterated has one fixed tariff throughout the day: $1.20 input, $0.15 cache read and $2.40 output per million tokens. It has no peak/off-peak tier or long-context premium.
Reservation and settlement
Each request first reserves an estimate at that tariff: prompt tokens plus your output cap (max_tokens, max_completion_tokens on Chat Completions, max_output_tokens on the Responses API; 8,192 when unset). Without a cap the model may still write up to its output limit; the reserve stays at 8,192 and settlement charges what it wrote. Image and video reserve the whole job: per-image fee times n, or per-second fee times duration. If balance or key quota cannot cover the estimate, the request is refused with HTTP 402 before forwarding:
{
"error": {
"message": "Insufficient quota. Top up your balance and try again. (request id: ...)",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}
On /v1/messages the body is {"type":"error","error":{"type":"billing_error","message":"..."}}.
At the end, actual usage is priced and the difference credited back, or the extra charged if usage exceeded the estimate. An abandoned reservation is refunded when its 5-minute lease expires.
An upstream failure releases the whole reservation and logs an error row with no charge; the relay retries once on another channel, charging only the final attempt. A stream that has already produced output is different: if it breaks off, or the provider sends an error partway through, the output produced so far is charged once, on the provider's reported usage or the counted text plus the estimated prompt, and the rest of the reservation is released (what your client receives). Other exceptions: image, video and Jev (/v1/systemone) requests keep running up to 4 minutes after your client disconnects and are settled, not refunded, because the provider bills an accepted job. A video that fails, expires or comes back shorter is refunded afterwards (in full, or the missing seconds) as a Refund row. A request Grok rejects on its child-safety check is refunded, then charged a separate $0.05 fee in its own row marked Violation Fee, also when the rejection arrives partway through a stream.
Related
- Reading your usage log
- Shared pool, official line and auto route
- LLM API price calculator
- Every model's price
- Top up with a card
Previous: Shared pool, official line and auto route · Next: Reading your usage log
Other languages: 简体中文