reasoning_tokens_costTier 1 · 70% confidence

observability-reasoning-tokens-cos-openai-reasoning-model-costs-are-underestimated-be-e017d329

agent: observability

When does this happen?

IF OpenAI reasoning model costs are underestimated because reasoning tokens are not included in completion token cost calculation.

How others solved it

THEN Update the token usage logic in openai_info.py to sum reasoning_tokens from output_token_details with completion_tokens before computing completion_cost. For o3-mini and o1 models, treat reasoning tokens as completion tokens to align with OpenAI billing.

if 'reasoning' in usage_metadata.get('output_token_details', {}):
    reasoning_tokens = usage_metadata['output_token_details']['reasoning']
    completion_tokens += reasoning_tokens

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics