Billing and balance
Credit is prepaid and spent per request: no subscription, no monthly bill. This page says how a request’s price is worked out, what happens when the balance runs low, and how to read the balance.
Prepaid credit
Section titled “Prepaid credit”Add credit on the Billing page of the dashboard. Every key of the account spends from the same balance, and every request takes its price from it as it is answered. Prices are in US dollars.
A model’s prices are in its entry in the list of models and on its page on the models page. They move with the market, so read them from the list rather than writing them into your code.
The price of a request
Section titled “The price of a request”A text request costs:
input tokens × input_per_mtok / 1,000,000+ output tokens × output_per_mtok / 1,000,000+ per_requestinput_per_mtokandoutput_per_mtokare the model’s prices per million tokens.per_requestis a fixed amount added once to each request. Many models have none.- Reasoning tokens are output tokens and are priced as such.
- There is no separate price for cached input: a prompt the model has seen before costs the same as a new one.
How input is counted
Section titled “How input is counted”Input tokens are counted by the gateway, in the same way for every model, with OpenAI’s o200k_base tokenizer. An image, audio or file part in a prompt counts as 765 tokens. Output tokens are the model’s own figure.
On Chat Completions the answer’s usage.prompt_tokens is that count, so the answer shows what was billed. On the Messages, Responses and Gemini endpoints the usage in the answer is the model’s own report and its input figure can differ from the billed one. The Usage page of the dashboard has what each request cost.
Other kinds of model
Section titled “Other kinds of model”| Kind | Priced on |
|---|---|
| Embeddings | Input tokens × input_per_mtok |
| Images | per_request for each image |
| Videos | per_request for each video, charged when it completes |
| Speech | Characters of input × input_per_mtok (per million characters) |
| Transcription | Tokens where the model reports them, otherwise seconds of audio |
For an image or a video, what is asked for (a size, a length) can make it cost less than the listed price; the charge is the actual cost, and the listed price is what applies when nothing else is known.
What is held before a request starts
Section titled “What is held before a request starts”Before a request goes to the model, the gateway sets aside what it could cost: the input, the per-request amount, and the output up to the request’s max_tokens (4,096 tokens when the request names no limit). When the answer is in, the actual cost is charged and the rest is released.
- If the balance covers that, the request runs as you sent it.
- If it does not, the request is not refused outright: the output limit is lowered to what the balance buys, and the answer comes back short, ending with
length. - If the balance cannot pay for the input and at least 16 output tokens, the request answers 402
insufficient_balanceand nothing is sent to the model.
Images and videos are held at the most the request could cost, which for a large size or a long clip can be above the listed price, so an account needs a little more than the list price to start one.
What is and is not charged
Section titled “What is and is not charged”| What happened | Charged |
|---|---|
| The request answered an error before any answer began: 400, 401, 402, 404, 429, 503, 504 | No |
| A stream broke off partway | Yes, for the input and what had been written |
| You closed the connection during a stream | Yes, for the input and what had been written |
| You stopped waiting for an answer that was not streamed | Yes, in full, if the model still answered |
| An image or a video failed, or did not finish in time | No |
Read the balance
Section titled “Read the balance”GET https://api.exoticrouter.com/v1/balance
curl https://api.exoticrouter.com/v1/balance \ -H "Authorization: Bearer $EXOTIC_API_KEY"import os, requests
balance = requests.get( "https://api.exoticrouter.com/v1/balance", headers={"Authorization": f"Bearer {os.environ['EXOTIC_API_KEY']}"},).json()print(balance["balance_usd"])const balance = await fetch("https://api.exoticrouter.com/v1/balance", { headers: { Authorization: `Bearer ${process.env.EXOTIC_API_KEY}` },}).then((r) => r.json());console.log(balance.balance_usd);{ "object": "balance", "balance_usd": 12.5, "currency": "USD" }- It is the balance of the account the key belongs to: every key of the account sees the same figure.
- It runs a second or so behind what is being spent, and it can be below zero after a request that outran what was held for it.
- The call takes a key in a header and counts toward the key’s rate limit.
Where next
Section titled “Where next”- Rate limits: Requests per minute, per key.
- Errors: What a 402 looks like, and every other status.