7. Knowing what it cost
Every non-streaming inference response — chat, responses, embeddings, rerank, classify, speech, transcription, images (generations and edits), moderation and the Anthropic drop-in — carries:
| Header | Meaning |
|---|---|
X-Nozzle-Cost-Micro-Cents | what this call cost, integer micro-cents |
X-Nozzle-Provider | which backend actually served it |
X-Nozzle-Upstream-Model | the provider's own name for the model |
X-Request-Id | correlation id, also the ledger key |
Ratelimit-Limit / -Remaining / -Reset | your current budget |
Why micro-cents and not dollars: a typical call costs a few thousand
micro-cents — well under one cent. Any float-of-dollars encoding reports that
as 0.00. Integer micro-cents is lossless and reconciles exactly against
GET /v1/billing/costs.
0 is a real answer, not a missing one: a dedicated pod prices tokens at zero
on purpose, because you are paying per GPU-hour instead.
Each ledger row from GET /v1/billing/costs carries cost_micro_cents,
request_id and the token counts, so a call's header reconciles to its row
by request_id to the unit. cost_cents on the same row is the whole-cent
rounding and reads 0 for most single calls.
GET /v1/billing/costsis not paginated today: it returns your whole ledger and ignoreslimit. Fetch it once and index in memory; useGET /v1/usagefor totals. The gateway mints therequest_idit stamps on the row — reconcile by theX-Request-Idresponse header, never by an id you sent.
The gateway stamps, the client reads, and nothing re-derives a price.
Streaming has no cost header and cannot. The cost is known only when the
terminal usage frame arrives, long after headers flush. HTTP trailers exist for
this but the OpenAI and Anthropic SDKs cannot read them, so promising cost
there would promise something most clients cannot collect. Streamed callers
reconcile through X-Request-Id.