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.
On the response
Section titled “On the response”"usage": { "prompt_tokens": 18, "completion_tokens": 52, "total_tokens": 70 },"katara": { "cost_usdc": "0.000018", "provider": "0xfFe5…38DC" }cost_usdc is a decimal string in USDC. provider is the address of the provider that served you, or managed when a vendor answered through Cortex. A reply from katara/cortex@1 adds a served block naming the concrete model, bundle and provider (see Katara Cortex). In a stream the katara object arrives as one final chunk with an empty choices array, after the usage chunk and before [DONE].
What counts as output
Section titled “What counts as output”Output tokens are what you received, measured with the model’s own tokenizer: the assistant text, and for each tool call its name and its argument document. A model’s private syntax around a call, anything Katara refused, and the runtime’s own token report are not billed. Both the provider and Katara compute the count independently from the same delivered content, and a reply only settles when the two agree exactly.
Input tokens come from the runtime’s count of the rendered prompt, bounded by the size of your request.
Retries
Section titled “Retries”Every request is charged at most once: a reply settles only against its own signed receipt, and a receipt can settle once. A failed attempt on one provider is retried on another inside the same request and never charged. If you retry a request yourself after a timeout, that is a new request. An Idempotency-Key header is honoured by the chat apps’ own service, not yet by the marketplace API.
Bounding cost
Section titled “Bounding cost”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.
Reconciling
Section titled “Reconciling”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.