OpenAI

How do I check my token usage?

Check your token usage for your API calls

Updated: 14 hours ago

There are two main options for checking your token usage:

1. Usage dashboard

The usage dashboard displays your API usage during the current and past monthly billing cycles. Playground uses the same API calls as your applications, so Playground tokens count toward your account’s API usage and follow the same usage rules and pricing. To display the usage of a particular user of your organizational account, you can use the dropdown next to "Daily usage breakdown".

2. Usage data from the API response

You can also access token usage data through the API. Token usage information is included in responses from our endpoints under the usage key.

Here's an example:

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1677858242,
"model": "gpt-3.5-turbo",
"usage": {
"prompt_tokens": 13,
"completion_tokens": 7,
"total_tokens": 20
},
"choices": [
{
"message": {
"role": "assistant",
"content": "This is a test!"
}
}
]
}

If you're using streaming for our completions and would like to access usage data, ensure that your stream_options parameter contains the following:


stream_options: {"include_usage": true}. Here's our cookbook for How to stream completions and our platform documentation on streaming.

Was this article helpful?