Skip to main content
Every successful response reports token usage, including streaming responses. Use it to track spend per request. For account-level usage and cost over time, use the usage API or the dashboard at app.wafer.ai.

Chat Completions usage

The response carries a usage object:
Successful streams end with a usage chunk before data: [DONE]. You don’t need to set stream_options. See Streaming.

Responses usage

/v1/responses returns usage.input_tokens, usage.output_tokens, and usage.total_tokens. output_tokens includes reasoning tokens. input_tokens_details.cached_tokens is included when there are cached tokens, and non-streaming responses can include output_tokens_details.reasoning_tokens. In streams, usage is on the response.completed event.

Messages usage

/v1/messages returns usage.input_tokens, usage.output_tokens, usage.cache_read_input_tokens, and usage.cache_creation_input_tokens. In streams, final usage is on the message_delta event.
On Wafer, input_tokens counts all prompt tokens, including cache_read_input_tokens. Anthropic’s own API excludes cached tokens from input_tokens. Subtract cache_read_input_tokens from input_tokens to get uncached prompt tokens. cache_creation_input_tokens is always 0: Wafer has no separate cache-write charge.

Prompt caching

Prompt caching is automatic. When a request starts with the same tokens as a recent request, Wafer reuses the cached prefix. You don’t need to send cache_control or any other field. Cached tokens are reported as prompt_tokens_details.cached_tokens (Chat Completions), input_tokens_details.cached_tokens (Responses), or cache_read_input_tokens (Messages), and bill at the cache-read rate. Cache hits aren’t guaranteed. To get more cache hits, keep the stable part of the prompt (system prompt, tool definitions, long documents) at the start and put changing content at the end.

How requests are billed

Serverless is prepaid. Each request is charged against your credit balance at the rates in the model’s wafer.pricing card (see Pricing):
  • Uncached prompt tokens (prompt tokens minus cached tokens) at input_microcents_per_million when present, otherwise input_cents_per_million.
  • Cached prompt tokens at cache_read_microcents_per_million.
  • Generated tokens, including reasoning tokens, at output_microcents_per_million when present, otherwise output_cents_per_million.
Each of the three amounts is rounded to the nearest microcent (one millionth of a cent) per request, with halves rounded up. On some models, generated tokens can exceed max_tokens when reasoning is on; see Output length. Call GET /v1/models with your API key to see your account’s rates. Without a key, the cards show list prices. Requests rejected before generation starts (authentication, validation, and rate-limit errors) are not charged. A stream that fails after it starts may be charged for tokens already generated. /v1/messages/count_tokens is free. Before a request runs, Wafer checks that your balance covers its maximum possible cost. When it doesn’t, Wafer returns 402 with code insufficient_credits. See Credits.

Dynamic pricing

Dynamic pricing is optional. When an account owner or admin turns it on in the Dynamic pricing card on the Billing page at app.wafer.ai, some models are billed at Wafer’s market price instead of the standard price. A dynamic price can be above or below the standard price, and changes whenever Wafer’s market pricing does. Each request is billed at the price in force when it arrives. Models without a dynamic price stay at the standard price. The Billing card lists today’s dynamic prices next to the standard prices, and GET /v1/models with your API key shows the rate your account pays. Turning dynamic pricing off takes effect immediately. Wafer Pass plan usage isn’t affected, and accounts with negotiated prices keep them.

Account usage API

GET https://api.wafer.ai/v1/usage returns your account’s requests, tokens, and billed cost over time. Authenticate with any API key on the account. The report covers every key on the account for that key’s endpoint.
The response has one entry in data per bucket, including empty ones, and totals for the whole window. This excerpt of the response to the request above shows only the first of its 30 daily buckets, so totals is larger than that one bucket:
  • input_tokens includes cache_read_tokens, as in per-request usage.
  • cost_usd is what each request was charged at your account’s rates, before invoice-level discounts or credits. Cost history starts on 2026-06-16; earlier buckets report cost_usd as null.
  • Cost is tracked per model, not per key. With group_by=api_key, each key’s cost_usd is null; the bucket and window totals still include cost.
  • Usage under a model name that can’t be shown is grouped under unavailable.
  • cost_status is billed when cost is reported, not_applicable for plans that aren’t billed per token, and unavailable when cost can’t be reported for this account (contact support).
  • Tokens are bucketed by request time and cost by billing time, so daily figures near midnight UTC can differ slightly. The most recent minutes may not be included yet.

Dashboard

The dashboard at app.wafer.ai shows your credit balance and usage, and is where you add credits. To track individual requests, use the usage object in each response and the x-request-id response header to correlate requests with your logs.