Claude Code 2.1.247 adds /claude-api cost-optimize to cut your bill
The same release lets subagents survive a first-call 404, stops runaway output from wedging a session, and gives Sonnet 5 its full 1M auto-compact window.

Copy markdown
Profile your Claude API spend, then cut it
`/claude-api cost-optimize` profiles an existing project and walks you through the cost levers — caching, token hygiene, batch, effort, and model choice — one measured change at a time instead of guessing where the bill comes from.
The /claude-api skill now drives the Admin API
The skill gained Admin API coverage: org members and invites, workspaces, API keys, rate-limit reports, workload identity federation, and CMEK. You can script key hygiene and CI identities from inside Claude Code.
Subagents stop dying on a first-call 404
A sub-agent whose first model returns 404 now falls back down the session's model chain instead of failing outright, and the parent gets the error type, status, request id, and model. One less silent break in multi-agent flows.
Runaway output can no longer wedge a session
A hook or background agent printing megabytes of errors could overflow the conversation and lock the session on "Prompt is too long." That's fixed, along with unbounded memory growth when an output file can't be written.
Cloud sessions recover from a container restart
Web, desktop, and mobile sessions that went silent when their container restarted mid-turn — with a background agent, shell, or monitor still running — now resume and report the lost work instead of hanging.
Sonnet 5 auto-compacts later, near 967K
Sonnet 5's default auto-compact window moved to its full 1M context, so 1M-window sessions now summarize around 967K tokens instead of ~934K — a little more headroom before compaction kicks in.