Skip to main content
Glama
dlaporte

openai-usage-mcp

by dlaporte

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

TableJSON Schema
NameRequiredDescriptionDefault
top_nNo
modelsNo
end_timeNo
group_byNo
start_timeYes
project_idsNo
bucket_widthNo1d
detail_levelNosummary
service_typeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses defaults (detail_level='summary', bucket_width='1d', top_n=10, end_time=today), service types, detail levels, and date format. However, it does not explicitly state that the operation is read-only or mention potential limitations like pagination, though the word 'Query' strongly implies a non-mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with headers, bullet lists, and example calls. It front-loads the purpose, then logically presents usage instructions, service types, detail levels, defaults, and examples. Every sentence contributes value, and the format is scannable without unnecessary padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter tool with no schema descriptions and no annotations, this description covers all key aspects: when to use, when not to use, service types, detail levels, defaults, examples, and date formatting. The output schema exists (per context signals), so return-value details are not required in the description. This is a comprehensive and self-contained guide.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description must compensate. It does so by listing service types, detailing detail levels, explaining defaults, and providing examples that illustrate parameter usage (e.g., 'group_by="project_id"' for project breakdown). However, not every parameter (e.g., project_ids, top_n) receives an explicit definition, though their meanings are inferable from context and examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Query OpenAI token and request usage data by service type' with a specific verb and resource. It also distinguishes itself from sibling tools by explicitly saying 'DO NOT USE THIS TOOL FOR: Dollar-amount costs (use 'costs' tool instead)'. This makes the purpose unambiguous and differentiates it from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit 'USE THIS TOOL FOR' and 'DO NOT USE THIS TOOL FOR' sections, listing alternative tools ('costs' and 'cost-comparison') for excluded use cases. It also includes concrete examples of when to call the tool (e.g., 'GPT-4o usage this month'), making the usage context crystal clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dlaporte/openai-usage-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server