Skip to content

Claude Code

Claude Code 2.1.300 splits cache writes by lifetime in OTel

3 min read

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →

Claude Code 2.1.300, released October 14, splits prompt-cache writes by lifetime in its OpenTelemetry data. The api_request event gains cache_creation_5m_tokens and cache_creation_1h_tokens, one counting writes to the 5-minute cache and the other writes to the 1-hour cache.

Until now those writes arrived as one combined number. The release notes on Github list the change next to GenAI attributes on trace spans, new mod APIs, changes to hook behaviour and a long list of fixes.

The two tiers are billed at different rates. A cache write costs 1.25 times the input price with the 5-minute lifetime and twice the input price with the 1-hour lifetime. A cache read costs about a tenth of the input price. Anthropic’s prompt caching docs give Claude Sonnet 5.5 at $2 per million input tokens, $2.50 for 5-minute writes and $4 for 1-hour writes. For Claude Opus 5.5 they list $4, $5 and $8.

Claude Code itself works around the one-hour cache. The previous release, 2.1.299, compacts a conversation of 200K+ tokens after about 54 minutes idle, so the compaction lands before its one-hour prompt cache expires. With the new fields, the more expensive 1-hour writes finally get a figure of their own in the telemetry.

Trace spans now carry attributes from OpenTelemetry’s GenAI semantic conventions, among them gen_ai.provider.name, gen_ai.conversation.id, gen_ai.tool.name and error.type. The release also fixes two telemetry bugs. When a mod’s prompt.submit hook rewrote or dropped a prompt, the user_prompt event, the interaction span and session title requests still recorded it as typed. And tool_result events were missing git_commit_id after git commit -q in repositories that use git’s reftable ref storage.

A few other changes affect existing configurations and defaults:

  • updatedInput from PreToolUse and PermissionRequest hooks is now validated like Claude’s own input. Unknown keys are dropped, and input the tool rejects denies the call.
  • Agent hooks now use their configured model. Aliases like haiku resolve, and if the model is unavailable the hook falls back to the caller’s model. Before this release it allowed the action.
  • /advisor arrives on Claude Platform on AWS. No advisor runs until you pick one with /advisor, advisorModel or --advisor, and CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1 turns it off.
  • Large requests to api.anthropic.com are now gzip-compressed even with telemetry disabled. CLAUDE_CODE_GZIP_REQUEST_BODIES=0 turns compression off.
  • claude remote-control no longer has --sandbox and --no-sandbox, which never did anything. Passing either one now exits with an error, and sandbox.enabled in settings is the way to sandbox sessions.

Mods get virtualText for prompt decorations, $.ui.view for opening an agent’s transcript and a prompt.change hook. Many of the remaining fixes cover session resume, worktrees and reftable repositories.

One fix changes what happens when the API rejects an MCP tool’s input schema. Before, that error made the conversation fail with a 400 on every turn. Now Claude Code sends that tool without parameters for the rest of the conversation.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.