You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenAI reasoning tokens double-counted in cost calculation #17566
Bug: For OpenAI reasoning models (e.g. gpt-4o, o1, o3), getUsage in session/index.ts adds reasoning tokens as a separate cost term on top of output tokens. But OpenAI's reasoning tokens are already a subset of completion_tokens — so they get billed twice.
Example with gpt-5.4-pro:
Input: 14,746 tokens @ $30/M = $0.44238
Output: 1,944 tokens @ $180/M = $0.34992
Reasoning: 1,360 tokens (subset of output)
Actual charge: $0.7923. OpenCode reports: ~$1.04 (overstated).
Anthropic bills thinking tokens separately (not included in outputTokens), so that provider is correct. The extra reasoning cost term should only apply to Anthropic/Bedrock.
Activity
rekram1-node commentedon May 27, 2026
believe this is fixed