Pricing and tokens
Every API price is in balance tokens. They are the same tokens you pay with on the site: one balance, one account. Top up in plans, where you can also see what a token costs in money.
Two kinds of tokens
These docs use the word "token" in two senses, and they must not be mixed up.
| Balance tokens | Model tokens | |
|---|---|---|
| What they are | The unit of account: the money on your balance is counted in them | The unit of text: the word pieces a model reads and writes |
| Where they appear | Catalog prices, usage.cost_tokens, GET /v1/balance, key limits, max_cost_tokens | prompt_tokens, completion_tokens, max_tokens, context_length |
| Who counts them | We do, at catalog prices | The model |
A text model's price links the two: how many balance tokens 1M model tokens cost.
Text models
Each model has two main rates, input (input) and output (output), both per 1M model tokens. A model's reasoning counts as output.
The formula of a request:
price = input tokens × input / 1,000,000 + output tokens × output / 1,000,000An example at made-up rates of input 300 and output 1500. A request with 1,000 tokens in and 500 out:
1,000 × 300 / 1,000,000 + 500 × 1,500 / 1,000,000 = 0.3 + 0.75 = 1.05 balance tokensEach model page already has this calculation at the model's real rates. What a given request was charged comes back in usage.cost_tokens.
Some models have extra rates:
cached_input: input read from the cache, usually several times cheaper than regular input;cache_write_5m,cache_write_1h: writing to the cache for 5 minutes and for 1 hour;long_context: rates for requests whose input is longer thanthreshold_tokens. The whole request is counted at them, not only the excess.
Web search is charged separately, per search: details.
Images, video and audio
A media price is balance tokens per generation. It depends on the model's mode and the request parameters, and it is known before the generation runs.
What usually changes the price:
- duration of a video: the rate per second is multiplied by the number of seconds;
- resolution and quality: 1080p costs more than 720p,
highmore thanlow; - input files: some modes also count the seconds of an uploaded video;
- add-ons: audio, HDR and other options multiply the price or add to it.
In the catalog a media model shows the price of its cheapest mode on that mode's example request, with a caption saying what the example is: "per video 5 s · 720p", "per image · 1K". On the model page every mode has a table of which parameter values cost how much.
Modes that process your file (editing, reframing) are counted by its length. The catalog shows their rate per second of input video, not a price per generation.
POST /v1/quotes gives the exact price of your request: the same body as creating a generation, with nothing run and nothing charged.
curl https://api.unitool.ai/v1/quotes \
-H "Authorization: Bearer $UNITOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "seedance", "mode": "seedance-2-5", "input": {"prompt": "A red fox in the snow", "resolution": "720p", "duration": 8}}'max_cost_tokens in a generation request caps the charge: if the price is higher, the request is refused before it runs.
Prices in the API
The API itself returns the prices the catalog pages show:
GET /v1/models: text models, with rates per 1M tokens inpricing;GET /v1/models?type=all: text and media together. A media model'spricing.fromis the price of its cheapest mode per generation, on that mode's example. Modes counted by the length of an input file are left out offrom: their lowest rate per second is inpricing.from_per_input_second;GET /v1/models/{id}: for a media model, the price make-up of every mode:matrix,addons,example_price.
The rates in the answer include your personal discount, if you have one. Ruble fields (*_rub) appear only when ruble prices are switched on for the API.
When prices change and when you do not pay
A price changes at once, with no notice. A request is counted at the price in force when it was admitted.
Refused requests, failed generations and a cancel before the start are not charged. Billing explains holds and charges.