API Docs
Platform Guides

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:

MeaningChat CompletionsResponsesMessages
Input (incl. cache)prompt_tokensinput_tokensinput_tokens + the two cache fields
of which cache readsprompt_tokens_details.cached_tokensinput_tokens_details.cached_tokenscache_read_input_tokens
of which cache writesprompt_tokens_details.cache_write_tokensinput_tokens_details.cache_write_tokenscache_creation_input_tokens
Output (incl. reasoning)completion_tokensoutput_tokensoutput_tokens
of which reasoningcompletion_tokens_details.reasoning_tokensoutput_tokens_details.reasoning_tokensincluded 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 carries usage.
  • Responses: response.usage in the terminal event, such as response.completed.
  • Messages: message_start has the input usage, message_delta the 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.

Usage trend chart in the console
public/docs/screenshots/console-usage.png · 1600×1000

Request 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.

Details of one call in the request logs
public/docs/screenshots/console-request-logs-detail.png · 1600×1000

The service tier actually billed is the tier shown in the request log; see Service tiers.

Reconciling a charge

  1. Take the X-Request-ID of the call in question from your application logs.
  2. Find that row in Request logs by request ID and check the model, tokens and charge.
  3. Recompute it from the response usage and 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.

Next steps