What is a token?
A token is a piece of data. Depending on the input, it can represent:- text, usually a word or part of a word
- image content converted into visual tokens
- audio content converted into audio tokens
1 token ≈ 4 characters in English.
Token Categories
| Category | What it means |
|---|---|
| Input tokens | Tokens you send in prompts, messages, files, images, or audio |
| Output tokens | Tokens the model generates in its response |
| Cached input tokens | Reused input tokens on providers that support prompt caching |
| Reasoning tokens | Extra model-internal reasoning work on supported reasoning models |
How Usage is Reported
Because NagaAI supports multiple API surfaces, the exact JSON shape varies by API. Every major API returns ausage object in its response, which you can log to track costs or analyze workloads.
Why usage shapes differ
Responsesfocuses on typed output items and can include richer usage detailsChat Completionsuses OpenAI-style fields such asprompt_tokensandcompletion_tokensMessagesuses Anthropic-style fields such asinput_tokensandoutput_tokens
Practical advice
- log usage for both successful requests and streamed requests when available
- watch for large input growth from long prompts, tools, or conversation history
- treat cached and reasoning usage as separate cost drivers when your models expose them
API-Specific Guides
Learn how to read the usage object and handle streaming usage for your specific API:Responses Usage
Usage tracking, cached tokens, and reasoning tokens in the primary Responses API.
Chat Completions Usage
prompt_tokens, completion_tokens, and include_usage in the OpenAI-compatible layer.Messages Usage
input_tokens and output_tokens in the Anthropic-compatible layer.Embeddings API
Input token tracking for vector generation.