Skip to content

Usage and cost

Every reply reports its cost. Use it directly rather than estimating from token counts and list prices: the number is what was settled on chain.

"usage": { "prompt_tokens": 18, "completion_tokens": 52, "total_tokens": 70 },
"katara": { "cost_usdc": "0.000018", "provider": "0xfFe5…38DC", "fallback": false }

cost_usdc is a decimal string in USDC. provider is the address of the provider that served you, or fallback. In a stream the katara object arrives as one final chunk with an empty choices array, after the usage chunk and before [DONE].

Send an Idempotency-Key header on requests you may retry. The same key with the same body returns the first response and charges once. A reused key with a different body is refused.

max_tokens bounds the output and so the maximum charge. The admission check uses it: a request whose maximum exceeds your spendable balance is refused before any work. Keep max_tokens honest for what you need and long prompts will fit in a smaller balance.

The portal’s usage page lists every request with its id, model, tokens, and cost. Match rows to your logs by x-katara-request-id. Settlements are visible on chain under your wallet address.