usage
Query OpenAI token consumption and request counts by service type, model, project, or API key. Monitor these metrics over time with summary or daily breakdowns.
Instructions
Query OpenAI token and request usage data by service type.
USE THIS TOOL FOR:
Token consumption (input, output, cached) by model
Request counts over time
Usage breakdown by model, project, or API key
Image generation counts, audio seconds, etc.
DO NOT USE THIS TOOL FOR:
Dollar-amount costs (use 'costs' tool instead)
Month-over-month cost comparisons (use 'cost-comparison' tool)
SERVICE TYPES: completions, embeddings, images, audio_speeches, audio_transcriptions, moderations, vector_stores, code_interpreter_sessions
DETAIL LEVELS:
summary (default): Compact table aggregated by model with totals.
daily: Per-day breakdown.
raw: Full unprocessed data.
DEFAULTS: detail_level='summary', bucket_width='1d', top_n=10, end_time=today
EXAMPLES:
GPT-4o usage this month: service_type="completions", start_time="2026-03-01", models="gpt-4o"
All completions last week: service_type="completions", start_time="2026-03-23"
Embeddings by project: service_type="embeddings", start_time="2026-03-01", group_by="project_id"
Dates in YYYY-MM-DD format.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | ||
| models | No | ||
| end_time | No | ||
| group_by | No | ||
| start_time | Yes | ||
| project_ids | No | ||
| bucket_width | No | 1d | |
| detail_level | No | summary | |
| service_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |