Claude Code Was Overbilling You on Bedrock, Vertex, Mantle, and Foundry: The Audit Checklist for Gateway Operators

Claude Code 2.1.211 fixes a prompt-caching billing regression that silently billed the trailing system context block as fresh input tokens on every request across Bedrock, Vertex AI, Mantle, and Foundry. Gateway operators have overcharges to investigate.

Published via Anthropic Claude Code

Archive item produced with AI assistance from the cited source and published without individual review. Editor of record: Joe Werner.

Abstract diagram of a cloud gateway with billing meters and highlighted cache miss indicators on a muted dark background

The headline buried at the bottom of the Claude Code 2.1.211 changelog deserves its own incident report: a prompt-caching regression on Bedrock, Vertex AI, Mantle, and Foundry was silently billing the trailing system context block as fresh input tokens on every single request. If your team routes Claude Code through any of these four cloud-provider gateways, you have been paying for cache hits as if they were cache misses — for an unknown number of turns before the fix shipped.

This is not a minor UI glitch. Prompt caching is one of the primary cost-reduction levers for teams running Claude Code at scale. When the system context block stops being cached and starts being billed fresh every turn, effective per-turn costs spike significantly on long-context sessions.

What happened

Claude Code 2.1.211, released this week, includes a one-line fix that resolves a regression in how the trailing system context block was being handled across the four cloud-provider gateway endpoints: Amazon Bedrock, Google Cloud Vertex AI, Anthropic Mantle, and Microsoft Azure Foundry.

The regression caused the last block of the system prompt to bypass the cache and be billed as new input tokens on every request, even when the content was identical to the previous turn. Teams using the direct Anthropic API were not affected — the issue was specific to the gateway provider paths.

Claude Code makes heavy use of prompt caching. The system context in a typical coding session includes instructions, project context, rules files, and tool schemas that are stable across many turns. Losing cache hits on this block means each turn incurs unnecessary token charges proportional to the size of that context block.

Why it matters for AI engineering teams

The regression affects four of the five major deployment paths for enterprise Claude Code:

GatewayAffected
Anthropic API (direct)No
Amazon BedrockYes
Google Cloud Vertex AIYes
Anthropic MantleYes
Microsoft Azure Foundry (via Claude apps gateway)Yes

Teams running Claude Code through a centralized AI gateway — routing all developer traffic through Bedrock or Vertex AI for data residency, compliance, or cost allocation — would have seen this regression on every session.

The impact is proportional to session length and system context size. Long-context coding sessions with large rules files and project instructions would have been affected most severely. Teams who recently noticed elevated cache-miss ratios or unexpected cost spikes in their Bedrock or Vertex AI invoices should audit the period before the 2.1.211 update.

The router/operator angle

This regression is a concrete example of a failure mode that AI gateway operators should build detection for: silent billing divergence between gateway paths and the canonical API.

What to check if your team routes Claude Code through Bedrock, Vertex, Mantle, or Foundry:

  1. Update immediately. Upgrade Claude Code to 2.1.211 or later across all developer workstations and CI environments. The fix is in place but only applies after the update.

  2. Audit recent invoices. Pull your Bedrock or Vertex AI usage logs for the last 30–60 days and compare cache-read vs. cache-write ratios. If you see cache_creation_input_tokens elevated relative to cache_read_input_tokens in a way that doesn't match session length expectations, the regression may account for the difference.

  3. Watch for subagent model drift. Claude Code 2.1.211 also fixes a related regression: subagents spawned with an explicit model override were reverting to the parent session's model when resumed or sent a follow-up message. For teams routing specific subagents to cheaper or faster models through a gateway, this means the routing decision was being silently overridden mid-session.

  4. Check gateway auth daemon reliability. A separate fix in 2.1.211 resolves background jobs on LLM gateway auth (ANTHROPIC_AUTH_TOKEN + ANTHROPIC_BASE_URL) coming back "Not logged in" after the daemon respawned them. This affects teams using custom gateway credentials rather than standard API keys.

Additional operator-relevant fixes in 2.1.210 and 2.1.208:

  • Worktree isolation gap closed (2.1.210): Subagents using isolation: 'worktree' could previously run git-mutating commands against the main repo checkout. This is a security boundary issue for teams using isolated subagents for untrusted code review.
  • Auto mode default fixed on Bedrock/Vertex/Foundry (2.1.210): /doctor was skipping its auto-mode-default proposal on these three platforms, where auto mode no longer needs an opt-in. Teams on managed deployments may have missed the auto-mode default.
  • Hook timeout misreporting fixed (2.1.210): Hook callback timeouts were being misreported to the model as user rejections, causing unattended sessions to stop and wait. This affects gateway operators using PreToolUse/PostToolUse hooks for policy enforcement.
  • Bedrock streaming response parsing fix (2.1.208): Bedrock streaming requests were failing with a misleading "Truncated event message received" when a gateway transforms the response. The error now names the content-type and points at the proxy.
  • Permission preview security (2.1.211): Permission previews relayed to chat channels were not neutralizing bidirectional-override, zero-width, and look-alike quote characters — a vector for tool inputs to visually alter the approval message. Fixed.

What TheRouter users should watch or try

Teams routing Claude Code through multi-provider gateways should treat the prompt-cache billing regression as a signal to instrument their cache efficiency metrics at the gateway layer, not just inside Claude Code's built-in cost counter.

Specifically: if your gateway collects per-request token breakdowns, add a check for cache_creation_input_tokens vs. cache_read_input_tokens ratios that drift above what your session length distribution would predict. A sudden increase in cache_creation relative to cache_read on a stable system context is a reliable indicator that caching is not working as expected on the gateway path.

The Claude apps gateway documentation describes the Bedrock and Vertex routing architecture. Teams on multi-cloud deployments should confirm their Claude Code version after the 2.1.211 update and compare cost metrics before and after to quantify the regression's impact.

Help & contact