Skip navigation
Contents

Account & billing

Billing

Prepaid, billed per token, in USD. No fixed fees and no rounding up to the nearest thousand tokens.

Units & prices#

  • The wallet and list prices are in USD; prices are quoted in USD / 1M tokens, with separate input, output and (where available) cache read / cache write prices. See the pricing table.
  • All amounts are integers with a smallest unit of 1 micro-USD (1 USD = 1,000,000 units) — no floating point, no accumulated rounding error.
  • Each request is rounded up exactly once, to the nearest micro-USD (0.000001 USD).
  • Embeddings bill input tokens only (there is no output); the hold covers input only as well.
cost = ⌈ (input_tokens × input_price + output_tokens × output_price
+ cache_read_tokens × cache_read_price + cache_write_tokens × cache_write_price) ÷ 1,000,000 ⌉

In the formula, prices are in micro-USD per 1M tokens and the result is in micro-USD. Example: a model priced at $2.50 (2,500,000) input and $10.00 (10,000,000) output per 1M tokens, and a request using 1,200 input tokens and 350 output tokens → 1,200 × 2,500,000 + 350 × 10,000,000 = 6,500,000,000 ÷ 1,000,000 = 6,500 micro-USD → $0.0065.

Rounding up: 1,234 input tokens at $0.15 / 1M → 1,234 × 150,000 ÷ 1,000,000 = 185.1 → 186 micro-USD ($0.000186).

Token counts come from the usage returned by the provider — the same usage you see in the response.

Hold, then charge actual usage#

Because the number of generated tokens isn’t known in advance, every request goes through two steps:

  1. Hold: before calling the model, the platform holds the most the request could cost = estimated input tokens (tokenizer, +10% safety margin) × input price + max_tokens × output price. If the available balance (balance − active holds) is not enough → 402 insufficient_balance and the model is not called.
  2. Charge: when the request finishes, the hold is released and the wallet is charged only for the actual usage. If the request fails before the model responds, the hold is released in full.

Getting 402 with money in your wallet?

The hold is based on max_tokens. If you don’t send max_tokens, it defaults to 4,096 output tokens. Set max_tokens close to what you need to hold less and run more requests in parallel.

Holds expire automatically after 10 minutes if a request hangs, so your available balance is never locked for long.

Streaming & disconnects#

  • Stream ends normally ([DONE])
    Billed
    The usage in the final chunk.
  • Client disconnects mid-stream
    Billed
    All of the input + the output generated up to the disconnect. If the provider hadn’t sent usage yet, output is counted with a tokenizer over the text already sent to you, and input uses the estimate from the hold.
  • Provider fails after sending partial output
    Billed
    Same as a disconnect: the generated part is billed.
  • Provider fails before any content
    Billed
    Not billed; the hold is released.

Balance#

  • Balance = total topped up − total spent. Available = balance − holds for in-flight requests.
  • The balance never goes negative. Every change (top-up, charge, refund, adjustment) is recorded in Transactions with the balance before and after.
  • Per-request details (model, tokens, cost, status) are in Usage.
  • An API key’s spend limit (if set) is in USD and applies to the key’s total cost plus its active holds.
  • The balance is in USD; VND bank-transfer top-ups are converted at the rate locked when the QR code is created (see Top-ups).

Amounts in the API#

Dashboard APIs return every amount in two forms: an integer in micro-USD (e.g. balance: 12500000) and an exact USD decimal string under the same name with a _usd suffix (e.g. balance_usd: "12.5"). Use either one, but never convert to floating point to do arithmetic on money. Model prices are returned as price_usd_per_1m / list_price_usd_per_1m (USD per 1M tokens, e.g. "0.15").

The dashboard Playground returns the cost of a (non-streaming) request in the X-Kompa-Cost-USD header, as an exact USD decimal string (e.g. 0.000186).

Custom pricing#

An account can be assigned a custom price plan or per-model custom prices; resellers get wholesale prices = list price × (1 − discount). The Models & pricing page in the dashboard always shows the prices that apply to you.