Tokens & usage
Read usage fields and understand the difference between request size and plan allowance.
On this page
Current availabilityWhat counts as a token?Read the usage objectContext size and allowanceCached input and plan tokensKeep requests efficientCurrent availability#
DSSUB is a design preview. Account, payment and API services are not connected. The examples and expected behavior below are integration references, not a verified production contract. A .invalid endpoint cannot accept real requests.
What counts as a token?#
A tokenizer splits text into units processed by the model. A token is not a fixed number of words or characters. Code, punctuation, languages and model tokenizers can produce different counts for similar-looking text.
Use returned usage for a request-level view rather than character estimates. For billing questions, also check the provider's accounting rules and usage records.
Read the usage object#
For a non-streaming Chat Completions response, inspect the usage object. Field availability can vary by provider.
| Field | Meaning |
|---|---|
prompt_tokens | Tokens in the request context |
completion_tokens | Tokens generated for the response |
total_tokens | Combined prompt and completion usage |
Messages from earlier turns count as input again when sent in a new request. Tool definitions, tool results and other supported inputs can also contribute to context usage.
Context size and allowance#
Context size limits how much a model can process in one request. A plan allowance limits consumption over a time window. A request can fit the model's context but exceed your plan's remaining allowance, or fail the context limit while you still have allowance left.
Cached input and plan tokens#
An official API cache discount concerns the provider's price calculation. Plan tokens may use a different conversion rule. Do not subtract cached tokens or assume they are free unless your plan explicitly says so. See usage and limits for plan counting rules.
Keep requests efficient#
- Send only the context needed for the current task.
- Avoid repeatedly attaching large generated files or logs.
- Keep output requests focused and set supported output limits where appropriate.
- Compare a small representative workload before changing model or plan.
Reference: DeepSeek token usage documentation.
Guide updated November 5, 2026 · All tutorials