[BUG] Opus 4.8 medium effort spends 46k output tokens on hidden thinking for a simple coding turn

Open 💬 6 comments Opened May 31, 2026 by Astro-Han

Preflight Checklist

  • [x] I have searched existing issues and did not find a clean duplicate for this specific failure mode
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

Opus 4.8 in Claude Code can spend an unexpectedly large amount of hidden thinking/output tokens on a routine coding turn even when effort is set to medium.

In one session, the visible task was a small mechanical code follow-up: inspect the impact of a rename / retry-label change before editing. The visible work was mostly grep/read/tool use and a short conclusion. No web search was involved.

Claude Code UI showed the turn thinking for about 22m 43s and about 105.6k tokens.

The underlying transcript has a completed request with:

  • model: claude-opus-4-8
  • input_tokens: 131
  • cache_read_input_tokens: 91,877
  • cache_creation_input_tokens: 4,054
  • output_tokens: 46,433
  • stop_reason: end_turn

The high cost appears to be mostly hidden thinking/output, not user-visible content. This happened under effort=medium, so medium effort behaved much closer to a high/xhigh thinking budget than a normal routine coding mode.

There was an ECONNRESET retry nearby in the session, but this specific high-token request completed normally with stop_reason=end_turn, so this does not look like only a networking/retry issue.

Related but not identical issues:

  • #64102: excessive token consumption mixed with API disconnects
  • #63455: simple tasks consuming 40-50k tokens, but the title/model metadata are unclear
  • #44344: extended thinking hangs/drains tokens, but older/different hang behavior
  • #63954: abnormal session-limit drain, more about quota accounting

What Should Happen?

effort=medium should materially constrain hidden thinking for routine coding/tool turns.

A simple rename-impact scan or small code follow-up should not spend ~46k output tokens mostly as hidden thinking. If medium effort is only soft guidance, Claude Code should provide either:

  • a hard per-turn thinking/output budget,
  • a clearer warning when a turn is burning tens of thousands of hidden output tokens,
  • or automatic effort step-down for simple tool/refactor turns.

Error Messages/Logs

No API 400 or tool parsing error for the high-token request.

Transcript usage for the completed request:
input_tokens: 131
cache_read_input_tokens: 91877
cache_creation_input_tokens: 4054
output_tokens: 46433
stop_reason: end_turn

Steps to Reproduce

  1. Start or resume a non-trivial Claude Code session with Opus 4.8.
  2. Set effort to medium.
  3. Ask for a routine coding follow-up, such as checking the impact of a simple rename before editing.
  4. Observe that Claude Code may spend tens of thousands of output tokens in hidden thinking before doing ordinary grep/read/tool work.
  5. Inspect the session JSONL and group assistant records by requestId; check message.usage.output_tokens.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version.

Last Working Version

Opus 4.6 / Opus 4.7 did not show this level of hidden thinking cost for comparable routine coding turns in my usage.

Claude Code Version

2.1.158 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

I can provide sanitized transcript snippets if useful. The important distinction is that this was not a failed request hitting max_tokens or an API 400 loop; the request completed normally, but spent 46k output tokens largely on hidden thinking under medium effort.

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗