Usage & Billing Records
Reconcile the tokens and charge of every call from three places — the usage object in the response, the X-Request-ID header, and the Usage and Request logs pages in the console.
Every real model call leaves three records that confirm each other: usage in the response,
the X-Request-ID response header, and one row in the console's Request logs. Match these three and the
bill reconciles.
usage in the response
Field names differ between the three protocols; their meanings map one to one:
| Meaning | Chat Completions | Responses | Messages |
|---|---|---|---|
| Input (incl. cache) | prompt_tokens | input_tokens | input_tokens + the two cache fields |
| of which cache reads | prompt_tokens_details.cached_tokens | input_tokens_details.cached_tokens | cache_read_input_tokens |
| of which cache writes | prompt_tokens_details.cache_write_tokens | input_tokens_details.cache_write_tokens | cache_creation_input_tokens |
| Output (incl. reasoning) | completion_tokens | output_tokens | output_tokens |
| of which reasoning | completion_tokens_details.reasoning_tokens | output_tokens_details.reasoning_tokens | included in output_tokens |
In Messages, input_tokens excludes cache reads and writes — add the three fields for total input. The two OpenAI
endpoints already include the cached part in their input total. How cache fields are billed is described in
Prompt caching & TTL.
Usage for streaming requests
- Chat Completions: add
"stream_options": {"include_usage": true}; the last data chunk carriesusage. - Responses:
response.usagein the terminal event, such asresponse.completed. - Messages:
message_starthas the input usage,message_deltathe final output usage.
stream = client.chat.completions.create(
model="gpt-5.6-sol",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.usage:
print(chunk.usage)Request ID
Every response carries an X-Request-ID header — the same value as Request ID in the request logs. You can also
send your own X-Request-ID (up to 128 characters, ASCII letters, digits and . _ - : only); it is used as-is, so
your own logs line up with the platform's records. See Authentication.
curl -i https://api.unioapi.com/v1/chat/completions \
-H "Authorization: Bearer $UNIO_API_KEY" \
-H "X-Request-ID: order-2026-11-05-001" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"Hello"}]}'Records in the console
Usage
Data → Usage shows token usage and charges over time — good for spotting trends and spikes.
public/docs/screenshots/console-usage.png · 1600×1000Request logs
Data → Request logs has one row per model call: time, IP, key prefix, endpoint, type, model, reasoning effort, tokens, latency, amount charged and request ID. Filter by key or endpoint, or use the search box, to isolate one key or one application.
public/docs/screenshots/console-request-logs-detail.png · 1600×1000The service tier actually billed is the tier shown in the request log; see Service tiers.
Reconciling a charge
- Take the
X-Request-IDof the call in question from your application logs. - Find that row in Request logs by request ID and check the model, tokens and charge.
- Recompute it from the response
usageand the unit prices on the model pages, following Billing & usage.
FAQ
There are more request logs than calls I made — agent tools make several calls per action and clients may retry automatically. Every real call is logged; see Billing & usage.
Usage totals and request logs differ — Usage aggregates by time and the last few minutes may still be processing. Refresh a little later and compare again.