Credits & Billing
Tchavi uses a credit-based billing system — each API request consumes credits based on the model used and the number of tokens processed.
Tchavi uses a credit-based billing system. Each API request consumes credits based on the model used and the number of tokens processed.
How credits are calculated
-
Chat models: Input and output are billed per token, each at its own rate, and the total is rounded up once to a thousandth of a credit:
textcredits = ceil( (input_tokens × input_rate + output_tokens × output_rate) / 1000 , 0.001 )There is no minimum per request and no rounding per side: a 40-token question at 1 credit per 1K costs 0.04 credits, not 1. Credits carry three decimals everywhere: balances,
X-Credits-Used, usage logs. -
What a request holds (
max_tokens): before a request runs, credits are held for what it could cost: your input, plus the output yourmax_tokensallows, bounded by what the model can emit. When the request ends the hold settles to what you actually used and the rest comes back. Somax_tokens: 128000holds what 128,000 output tokens would cost on that model, even when the answer turns out to be two lines, and an account that cannot cover it is refused with a 402 naming the figure. Setmax_tokensto what you really need and the hold follows it. -
Cached input: when a provider serves part of your prompt from its cache, those tokens are billed at a cache rate of their own, not the input rate. See Prompt caching below.
-
Image models: Flat credit cost per image. GPT Image bills by
quality(low / medium / high), Nano Banana byresolution(0.5K to 4K), FLUX.2 and Seedream a single flat rate. Rectangular sizes carry a 1.5× surcharge, applied exactly. -
TTS (text-to-speech): Credits per 1K characters of input text, billed per character (1 234 characters at 32 credits/1K cost 39.488 credits)
-
Transcription (Whisper): Credits per minute of audio, rounded up to the next whole minute (the provider's own billing unit)
-
Video models: Credits per second of video, varies by resolution (some models add a surcharge when audio is generated). Motion-control models, whose output length follows a reference video (e.g.
kling-v3-motion-control), reserve credits at the maximum possible length upfront and automatically refund the unused part once the actual length is known.kling-v4bills any input video on top of the output, by its length: see Video generation. -
Music models: A flat price per generated track, whatever its length. There is no duration parameter. A job that fails after billing is refunded in full. See Music generation.
Response headers
Every API response includes metadata headers:
| Header | Description |
|---|---|
X-Credits-Used | Credits consumed by this request |
X-Credits-Remaining | Your current credit balance |
X-RateLimit-RPM-Limit | Your requests-per-minute limit |
X-RateLimit-RPM-Remaining | Requests remaining in the current minute |
X-RateLimit-TPM-Limit | Your tokens-per-minute limit |
X-RateLimit-TPM-Remaining | Token budget remaining in the current minute |
X-Request-Id | Unique request ID for support/debugging |
Retry-After | Seconds to wait before retrying (on 429 responses) |
Example credit calculation. A request with 500 input tokens + 200 output tokens on a model priced at 1 cr/1K input and 2 cr/1K output (illustrative rates) costs:
500 × 1 / 1000 = 0.500 credits (input)
200 × 2 / 1000 = 0.400 credits (output)
─────────────
0.900 creditsThis request costs 0.9 credits, exactly its proration. A message ten times shorter costs ten times less, so there is no penalty for many small requests; the only thing that changes your bill is the number of tokens and the model.
X-Credits-Used on every response tells you exactly what a call cost, so you never have to work it out by hand. The exact rate for each model is shown in the Models table.
Prompt caching
Agents and chat apps resend the same conversation on every turn. Providers keep the repeated prefix in a cache and charge a fraction of the normal price to read it back. Tchavi passes that straight through: a cached input token costs a fraction of the input rate, the same fraction the provider charges for that model, often a tenth.
| Token class | Rate | When it applies |
|---|---|---|
| Input | the model's input rate | tokens the model processed fresh |
| Cached input | the model's cache-read rate, often 0.1 × input rate | tokens the provider served from its cache |
| Cache write | 1.25 × input rate | tokens written to the cache, on providers that charge for it |
| Output | the model's output rate | generated tokens |
On OpenAI models this is automatic. Prompts above roughly 1 000 tokens are cached by the provider with no change to your code, and repeated calls simply cost less. Anthropic models do not pass cache markers through yet, so a Claude conversation is currently billed entirely at the input rate.
The difference is large for a long-running agent. A turn that sends 120 000 tokens of context, of which 110 000 is a repeat, costs a quarter of what it would at the flat input rate.
Your usage log records the three input classes separately, so you can see how much of a request was a cache hit.
Cache rates are only applied to models where the provider's cache pricing has been verified. Everywhere else a cached token is billed at the ordinary input rate, which is what Tchavi did for every model before this existed, never more than the rate shown in the Models table.
Recharging
Buy credits from your billing dashboard using mobile money. The full list of supported operators and countries is published live at /api/payments/providers. Top-ups start at 1 000 FCFA, credits are added instantly after payment, and they never expire. A new account in a country where we can take payment receives 50 trial credits when its email address is verified, capped daily and not guaranteed. Your first top-up carries +150 bonus credits on top of that, once per account, and it also moves your account from the Free level to Builder (see Rate Limits).
See also Rate Limits and Error Handling.