Guides · Concept · 5 min
Control what you spend
Unbound charges for what a request actually used. This page explains how the charge is calculated and the three controls you have over it.
Holds and settlement
Every request goes through the same three steps.
- Hold. Before anything is sent to a provider, Unbound works out the most the request could cost and holds that amount from your balance. For chat, that is the prompt plus
max_tokensof output at the model's published prices. For images, it is the exact price of the request. - Run. The request goes to the provider.
- Settle. The real usage is charged. Whatever is left of the hold goes back to your balance. If the request failed, the whole hold goes back.
Held credit shows as "Held for running requests" in Usage & billing. It is not spent, only unavailable until the request settles.
Control 1: max_tokens
max_tokens caps both the output and the hold. Without it, the hold has to cover the largest output the model can produce, which can make a request fail with 402 even though it would have cost far less.
{
"model": "<model-id>",
"messages": [{ "role": "user", "content": "Summarise this in one paragraph." }],
"max_tokens": 300
}
Control 2: a spending limit per key
When you create a key you can give it a spending limit in dollars. Once the key has spent that much, its requests fail with 402 insufficient_quota and code spend_limit_exceeded, while your other keys keep working. Use a separate key, with its own limit, for each application or environment.
Limits and the amount each key has spent are listed in Settings → API → Keys.
Control 3: your balance
The API never spends more than your balance. There is no overdraft and no automatic top-up. When the balance cannot cover a hold, the request fails with 402 and code insufficient_credits before it reaches a provider.
Reading your usage
Settings → API shows requests, tokens and cost by model and by day. Each row in the usage history carries the x-request-id that was returned with the response, so you can match a line in your logs to a charge.
Token counts come from the provider when it reports them. If a stream is cut off before the provider sends its totals, the output is counted from the text that was delivered.
Prices
Prices are per model and are listed on the models page and in GET /v1/models. Input and output tokens are priced separately, and some models have a lower price for cached input. The price in force when a request starts is the price it is charged at.