> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter-d02e98a0-mintlify-7021d5f4.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ChatUsage - Python SDK

> ChatUsage method reference

<Warning>
  The Python SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/python-sdk/issues).
</Warning>

Token usage statistics

## Fields

| Field                       | Type                                                                                               | Required             | Description                                                         | Example                                                                                                                    |
| --------------------------- | -------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `completion_tokens`         | *int*                                                                                              | :heavy\_check\_mark: | Number of tokens in the completion                                  |                                                                                                                            |
| `completion_tokens_details` | [OptionalNullable\[components.CompletionTokensDetails\]](../components/completiontokensdetails.md) | :heavy\_minus\_sign: | Detailed completion token usage                                     |                                                                                                                            |
| `cost`                      | *OptionalNullable\[float]*                                                                         | :heavy\_minus\_sign: | Cost of the completion                                              |                                                                                                                            |
| `cost_details`              | [OptionalNullable\[components.CostDetails\]](../components/costdetails.md)                         | :heavy\_minus\_sign: | Breakdown of upstream inference costs                               | `{"upstream_inference_completions_cost": 0.0004,"upstream_inference_cost": null,"upstream_inference_prompt_cost": 0.0008}` |
| `is_byok`                   | *Optional\[bool]*                                                                                  | :heavy\_minus\_sign: | Whether a request was made using a Bring Your Own Key configuration |                                                                                                                            |
| `prompt_tokens`             | *int*                                                                                              | :heavy\_check\_mark: | Number of tokens in the prompt                                      |                                                                                                                            |
| `prompt_tokens_details`     | [OptionalNullable\[components.PromptTokensDetails\]](../components/prompttokensdetails.md)         | :heavy\_minus\_sign: | Detailed prompt token usage                                         |                                                                                                                            |
| `total_tokens`              | *int*                                                                                              | :heavy\_check\_mark: | Total number of tokens                                              |                                                                                                                            |
