[BUG] Cache TTL silently downgrades from 1h to 5m when Extra Usage is active

Resolved 💬 4 comments Opened Apr 4, 2026 by p948tzqwxr-bit Closed May 14, 2026

Describe the bug

When a Max subscriber's included plan usage runs out and Extra Usage kicks in, the client stops requesting ttl: "1h" on cache_control markers and falls back to the default 5-minute TTL. This happens silently — no notification, no log entry.

The function responsible is IuY in cli.js (v2.1.91). It checks Zk.isUsingOverage and returns false when Extra Usage is active, which causes vQ() to omit ttl: "1h" from all cache control blocks.

This creates a death spiral: cache bugs drain included usage faster than normal → Extra Usage kicks in → caching degrades further → Extra Usage balance burns through faster.

To reproduce

  1. Install via npm: npm install -g @anthropic-ai/claude-code (v2.1.91)
  2. Search for the function: grep -c 'isUsingOverage' $(readlink -f $(which claude))
  3. The function IuY checks three conditions before allowing 1h TTL:
  • Must be Claude.ai subscriber
  • Must NOT be on Extra Usage (!Zk.isUsingOverage)
  • Query source must match internal allowlist
  1. When condition 2 fails, all cache_control markers use 5m TTL

Evidence that the server honors 1h TTL

Direct API testing confirms the server accepts and returns ephemeral_1h_input_tokens in the usage breakdown when ttl: "1h" is requested. The server is not blocking 1h — the client stops asking.

Impact

A typical Opus session with 220K context:

  • 90% cache hit (1h TTL): ~$0.22/turn equivalent
  • 50% cache hit (5m TTL, pauses >5min): ~$0.61/turn equivalent
  • This is a 2.8x cost increase per turn, charged to the Extra Usage balance

Users paying Extra Usage (API rates) receive degraded caching compared to users on included plan usage, resulting in faster Extra Usage consumption.

Workaround

Patching IuY to always return true forces 1h TTL regardless of usage state. This is overwritten by updates.

Environment

  • Claude Code v2.1.91 (npm)
  • Linux (WSL2)
  • Max 20x plan

Related issues

  • #41788 (rate limit exhausted in 70 minutes)
  • #38029 (abnormal usage on session resume)
  • #40524, #34629 (cache bugs)

Additional context

Session JSONL data confirms cache ratios of 97-99% on npm with the patch applied, compared to degraded ratios when Extra Usage was active pre-patch. Cross-platform comparison (Windows npm vs WSL native installer) over 3 weeks shows consistent cache performance on npm and degraded performance on the native binary.

View original on GitHub ↗

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