Skip to main content
This example demonstrates how to collect special token metrics including audio, cached, and reasoning tokens. It shows different types of advanced metrics available when working with various OpenAI models.

Code

agent_extra_metrics.py

Usage

1

Create a Python file

Create agent_extra_metrics.py with the code above.
2

Set up your virtual environment

3

Install dependencies

4

Export your OpenAI API key

5

Run Agent