> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://openrouter.ai/docs/llms.txt.
> For full documentation content, see https://openrouter.ai/docs/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://openrouter.ai/docs/_mcp/server.

# Usage - Python SDK

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

Token usage information for the response

## Fields

| Field                   | Type                                                                                   | Required             | Description                                                         |
| ----------------------- | -------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `input_tokens`          | *int*                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `input_tokens_details`  | [components.InputTokensDetails](/docs/sdks/components/components/inputtokensdetails)   | :heavy\_check\_mark: | N/A                                                                 |
| `output_tokens`         | *int*                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `output_tokens_details` | [components.OutputTokensDetails](/docs/sdks/components/components/outputtokensdetails) | :heavy\_check\_mark: | N/A                                                                 |
| `total_tokens`          | *int*                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `cost`                  | *OptionalNullable\[float]*                                                             | :heavy\_minus\_sign: | Cost of the completion                                              |
| `cost_details`          | [Optional\[components.UsageCostDetails\]](../components/usagecostdetails.md)           | :heavy\_minus\_sign: | N/A                                                                 |
| `is_byok`               | *Optional\[bool]*                                                                      | :heavy\_minus\_sign: | Whether a request was made using a Bring Your Own Key configuration |