Accounts & billing
Usage accounting
What you're charged for, what every usage field means, how cost is calculated, and how to look up the record of any request.
Every response reports what was measured and what it cost, in the key's currency. GET /generation returns the authoritative record of any request after the fact.
What you're charged for
You pay for output delivered to you, at the offer's listed rates, based on the provider's reported usage as validated by Numes.
No output, no charge. A request that fails before delivering output costs nothing, and the funds held for it are released.
Only the endpoint that delivers is charged. If one endpoint fails before output and another then serves the request, you pay only for the one that served it. Output from two endpoints is never combined. See Fallbacks.
Delivered output is charged whatever it says. A refusal, or output that fails your own validation such as invalid JSON, is charged like any other response.
GET /generation is the authoritative record of what each request delivered and cost.
The usage object
Every buffered response and the final chunk of every stream include usage. It can't be switched off; stream_options.include_usage and usage.include are accepted and ignored.
{ "prompt_tokens": 1204, "completion_tokens": 312, "total_tokens": 1516, "token_count_basis": "provider_native", "native_tokens": { "prompt_tokens": 1204, "completion_tokens": 312, "reasoning_tokens": 0, "cache_read_tokens": 1024 }, "cost": 0.002667, "cost_details": { "upstream_inference_cost": 0.002667 }, "prompt_tokens_details": { "cached_tokens": 1024 }, "completion_tokens_details": { "reasoning_tokens": 0 }}usage
prompt_tokensintegerBilled input tokens.
completion_tokensintegerBilled output tokens, including any reasoning.
total_tokensintegerprompt_tokens + completion_tokens.token_count_basisstringprovider_nativewhen the counts are the provider's validated token counts,gateway_estimateotherwise.native_tokensobjectThe provider's validated token counts, when reported.
Show child attributesHide child attributes
prompt_tokensintegerInput tokens.
completion_tokensintegerOutput tokens.
reasoning_tokensintegerReasoning tokens within the output, when reported.
cache_read_tokensintegerInput tokens read from the provider's cache, when reported.
cache_write_tokensintegerInput tokens written to the provider's cache, when reported.
gateway_billing_unitsobjectBilled quantities on some older requests, with
prompt_units,completion_unitsandreasoning_units. Absent on current requests.usage_meterstringAn identifier of the offer's billing basis. Treat it as opaque.
costnumberTotal charge in the key's currency: US dollars for USD keys, sats for BTC keys.
cost_detailsobjectBreakdown of
cost.Show child attributesHide child attributes
upstream_inference_costnumberThe provider's share of
cost.
prompt_tokens_detailsobjectCache split of the input, when known.
Show child attributesHide child attributes
cached_tokensintegerTokens read from cache.
cache_write_tokensintegerTokens written to cache.
completion_tokens_detailsobjectPresent when the reasoning split is known.
Show child attributesHide child attributes
reasoning_tokensintegerReasoning tokens within the output.
input_imagesintegerInput images. Only when non-zero.
output_imagesintegerGenerated images. Only when non-zero.
input_audio_secondsnumberInput audio duration. Only when non-zero.
output_audio_secondsnumberOutput audio duration. Only when non-zero.
hosted_tool_usageobjectHosted-tool quantities by billed item, such as a number of searches. Only when a hosted tool was billed.
Dedicated media endpoints report usage in their own units: images for image generation, input characters and output audio seconds for speech, and audio seconds for transcription. Embeddings report prompt_tokens, total_tokens and cost.
How cost is calculated
cost = Σ (billed quantity × offer rate) for each priced dimensionOffer rates are the per-unit prices in
GET /modelsand the endpoints list: per input and output token, plus any per-request, image, audio, cache, reasoning or hosted-tool rate.No markup on requests. The platform fee is charged when you buy credits, so
cost_details.upstream_inference_costequalscost. See Credits and payments.Prices are locked per request. A price change while a request runs doesn't affect it.
Reasoning counts as output, charged at the offer's reasoning rate when it has one and at the output rate otherwise. See Reasoning.
Prompt caching. Input read from or written to the provider's cache is charged at the offer's cache rates, which are never higher than its input rate, based on the cache usage Numes accepts from the provider's response. The saving appears as
cache_discounton the generation and Saved by cache in Logs. See Prompt caching.
Exact decimals
Costs are exact decimal values in the key's currency, written as JSON numbers. Parse them as decimals if you add them up, for example with json.loads(text, parse_float=Decimal) in Python. Never add USD and BTC amounts together.
Reservations
Before a request runs, an upper bound of its cost is held against your balance and spending limits. Unused funds are released when it completes, and only the actual charge is taken. A request whose upper bound exceeds your available funds or a spending limit is rejected with 402 before it runs. See Credits and payments.
Usage in streams
A successful stream ends with a usage-only chunk whose choices array is empty, followed by data: [DONE]. If a stream ends with an error or your connection drops, there's no usage chunk; look up the generation instead. See Streaming for the event format.
Look up a generation
GET /generation returns the record of one request: outcome, delivery, final usage, cost and every endpoint tried. After a disconnect or a mid-stream error, it's the authoritative record of what was delivered and charged.
The generation ID is the id of a chat completion and the value of the X-Generation-Id response header, present on every response that started delivering. Call it with an inference key from the same account; another account's generation returns 404.
curl "https://api.numes.ai/api/v1/generation?id=0f5b5c9a-3a7e-4c6f-9b1d-2e8f7a6c5d41" \ -H "Authorization: Bearer $NUMES_API_KEY"Show an example response
{ "data": { "id": "0f5b5c9a-3a7e-4c6f-9b1d-2e8f7a6c5d41", "request_id": "7c1e0a9b2d3f4e5a6b7c8d9e0f1a2b3c", "model": "openai/gpt-6-luna", "provider_name": "Example Provider", "provider_slug": "example-provider", "endpoint": "example-provider/primary", "created_at": "2026-09-28T10:15:02Z", "completed_at": "2026-09-28T10:15:05Z", "outcome": "success", "streamed": true, "cancelled": false, "delivered_output": true, "usage": { "prompt_tokens": 1204, "completion_tokens": 312, "total_tokens": 1516, "cost": 0.002667, "cost_details": { "upstream_inference_cost": 0.002667 } }, "total_cost": 0.002667, "upstream_inference_cost": 0.002667, "cache_discount": 0.000921, "attempts": [ { "ordinal": 1, "provider_name": "Other Provider", "provider_slug": "other-provider", "endpoint": "other-provider/main", "dispatch_state": "confirmed", "financial_status": "finalized", "outcome": "failed", "failure_class": "rate_limited", "delivered_output": false, "cancelled": false, "usage": { "prompt_tokens": 0, "completion_tokens": 0 }, "total_cost": 0, "upstream_inference_cost": 0 }, { "ordinal": 2, "provider_name": "Example Provider", "provider_slug": "example-provider", "endpoint": "example-provider/primary", "dispatch_state": "confirmed", "financial_status": "finalized", "outcome": "success", "delivered_output": true, "cancelled": false, "usage": { "prompt_tokens": 1204, "completion_tokens": 312, "cache_read_tokens": 1024 }, "total_cost": 0.002667, "upstream_inference_cost": 0.002667 } ] }}Response `data`
idstringGeneration ID (a UUID).
request_idstringThe request's
X-Request-Id.modelstringRequested model ID.
provider_namestring | nullDisplay name of the provider that served the response;
nullif none did.provider_slugstring | nullRouting slug of that provider.
endpointstring | nullThe serving endpoint as a
provider/endpointrouting selector.created_atstringWhen the request was accepted.
completed_atstring | nullWhen it finished;
nullwhile running.outcomestringFinal result; see the table below.
streamedbooleanWhether the request used streaming.
cancelledbooleanWhether you cancelled or disconnected.
delivered_outputbooleanWhether any billable output reached you.
usageobjectFinal billed usage, in the same shape as the response
usagewithout the provider's raw counts.usage_meterstringOpaque identifier of the billing basis.
total_costnumberTotal charge in the key's currency.
upstream_inference_costnumberThe provider's share of
total_cost.cache_discountnumberAmount saved by prompt caching.
attemptsobject[]Every endpoint tried, in order.
Show child attributesHide child attributes
ordinalintegerAttempt number, starting at 1. Numbers can have gaps.
provider_namestringDisplay name of the provider tried.
provider_slugstringRouting slug of the provider tried.
endpointstringEndpoint tried, as
provider/endpoint.dispatch_statestringconfirmedwhen the request reached the provider,uncertainwhen that couldn't be confirmed.financial_statusstringfinalized, orpendingwhile the charge is being finalized.outcomestringResult of this attempt.
failure_classstringShort code for why it failed, such as
rate_limited. Omitted on success.delivered_outputbooleanWhether this attempt delivered billable output.
cancelledbooleanWhether the attempt ended because of a cancel.
usageobjectBilled quantities for this attempt:
prompt_tokens,completion_tokens, and when presentreasoning_tokens,cache_read_tokens,cache_write_tokens,input_images,output_imagesandinput_audio_milliseconds. Zero while pending.total_costnumberWhat this attempt cost. Absent while pending.
upstream_inference_costnumberThe provider's share. Absent while pending.
outcome | Meaning |
|---|---|
in_progress | Still running, or the charge isn't final yet; usage and cost read zero |
success | Completed and delivered |
cancelled | You cancelled or disconnected |
partial_failure | Failed after some output was delivered |
failed | Failed before any output; not charged |
delivery_failure | The response couldn't be fully delivered |
| Any other value | The request ended without a normal result |
For every outcome, total_cost is what you were charged. A pending charge isn't the same as zero: poll again until financial_status is finalized.
The record never contains prompt or response content, keys or session IDs.
Usage in the dashboard
Every request also appears in Logs with its Usage and cost panel. See Activity and logs.