Claude Code v2.1.307 adds /claude-api migration command and safety telemetry
Claude Code v2.1.307, posted to the project's release notes on 21 October 2026, adds a /claude-api api-version command that moves Claude API code to API version 2026-10-21. It also introduces a claude_code.safety_event OpenTelemetry event emitted for each tool call that a permission rule, auto mode, a safety check, a hook or the sandbox stopped, prompted or sent back. The update additionally fixes model-not-found errors for [1m]-suffixed aliases such as opus[1m] when CLAUDE_CODE_DISABLE_1M_CONTEXT is set, stops sending the prompt-caching-scope beta header behind custom ANTHROPIC_BASE_URL gateways and on Foundry, and limits HTTP MCP retries to read-only or idempotent tools after a mid-call disconnect.
The release gives teams a built-in way to shift Claude API code to the 2026-10-21 API version and, through the new safety_event telemetry, a signal for when permission rules, hooks or the sandbox intervene in tool calls.