CLAUDE LABJP
MODEL — Claude Fable 5.1 and Claude Mythos 5.1 landed on September 1. They are the same underlying model; only the strength of the safeguards differsPRICING — Per-token rates hold at $10/$50 per MTok. What changed is cache reads, cut 75% to $0.25 per MTokCOST — How much that saves depends on your workload: roughly 25% for typical use, up to about 45% for context-heavy agentic work. Worth measuring your own split before quoting a numberBENCH — Terminal-Bench-Science 0.1 climbs from 24.7% on Fable 5 to 52.6%. Anthropic also states a standard error of 3.5-4.5 points, which is worth remembering before reading small gaps as realSAFEGUARDS — Sharper cyber safeguards cut interventions in Claude Code sessions by roughly 60% on average. Finding vulnerabilities is now allowed; developing exploits still is notAPI — New API accounts created from today can no longer edit prior context while preserving Claude's thinking transcript. It is an anti-distillation measure, and existing accounts are unaffected for nowMODEL — Claude Fable 5.1 and Claude Mythos 5.1 landed on September 1. They are the same underlying model; only the strength of the safeguards differsPRICING — Per-token rates hold at $10/$50 per MTok. What changed is cache reads, cut 75% to $0.25 per MTokCOST — How much that saves depends on your workload: roughly 25% for typical use, up to about 45% for context-heavy agentic work. Worth measuring your own split before quoting a numberBENCH — Terminal-Bench-Science 0.1 climbs from 24.7% on Fable 5 to 52.6%. Anthropic also states a standard error of 3.5-4.5 points, which is worth remembering before reading small gaps as realSAFEGUARDS — Sharper cyber safeguards cut interventions in Claude Code sessions by roughly 60% on average. Finding vulnerabilities is now allowed; developing exploits still is notAPI — New API accounts created from today can no longer edit prior context while preserving Claude's thinking transcript. It is an anti-distillation measure, and existing accounts are unaffected for now
Articles/Claude Code
Claude Code/2026-09-02Intermediate

Two hooks that record every model switch and stop the ones you never agreed to

Build a PostModelSwitch hook that logs every model change and a PreModelSwitch hook that blocks unapproved switches during unattended runs. Complete scripts, measured timings, and the reason the two jobs must stay separate.

Claude Code244hooks18PreModelSwitchPostModelSwitchautomation108

Premium Article

Last week my weekly usage on a set of unattended scheduled runs came in higher than I expected, so I went looking for the breakdown. My logs had the outcome of every run and the artifacts it produced. What they did not have, anywhere, was a record of when the session changed models.

As an indie developer running four sites on scheduled automation, splitting work across models is the obvious design. Formatting and search-and-replace go to something light; rewriting an article goes to something heavier. The problem was that this split existed as an intention, not as an observation. I had never once written down what actually happened.

Claude Code v2.1.251 added two hook events for exactly this: PreModelSwitch and PostModelSwitch. We are going to build a recorder and a guard — as two separate hooks, on two separate events. The separation is the interesting part, so let's start there.

A usage total cannot be decomposed after the fact

The Claude Code weekly limit is a shared pool across models. The status line JSON exposes rate_limits.seven_day alongside seven_day_opus and seven_day_sonnet, which tells you the pool carries per-model sub-buckets inside a single ceiling.

Practically, that means any run that used a heavier model than intended has already eaten into the room left for everything else. And from September 14 the weekly limit settles at +25% over the pre-promotion baseline — lower than the +50% in effect now, which makes this a reasonable moment to re-measure how the allocation actually behaves.

Re-measuring needs data. Checking /usage afterwards gives you a total, not an attribution. Some information exists only at the instant the switch happens, so the recorder has to be in place first.

What the two events hand you

PreModelSwitch fires immediately before a switch. PostModelSwitch fires after the session's model has changed. Where other hooks receive things like tool_name, these two receive fields that describe the switch itself.

FieldTypeMeaning
from_modelstringModel in use before the switch
to_modelstringModel being switched to
requested_modelstring | nullThe explicitly requested model; null when the switch was automatic
source"command" | "picker" | "sdk"How the switch was triggered: the /model command, the interactive picker, or the SDK
context_tokensnumberContext size at that moment
prompt_cache_warmbooleanWhether the prompt cache is currently warm
cache_ttl"5m" | "1h"Cache lifetime in effect
estimated_cache_write_usdnumberEstimated cost of the cache write, in USD
pricing"configured" | "catalog" | "default"Which price table produced that estimate

The usual session_id, transcript_path, and cwd come along too. PostModelSwitch carries the same fields, with two additional possible values for source.

That source field is what lets you tell a human choosing a model at a picker apart from a switch that happened inside an unattended run. That distinction becomes the hinge for the guard.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
You will be able to explain, after the fact, which unattended run consumed which model instead of guessing from a single usage total
You will avoid the failure mode where a heavy step inside PreModelSwitch quietly stops model switching altogether
You will be able to fold the cache write cost reported by estimated_cache_write_usd into a switching decision you were making on per-token price alone
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

Claude Code2026-08-28
Don't let your verification script's full output flow back through a hook
The check was working the whole time. The conversation was what ran out of room. Measured side by side: one scan of 833 files returns 58 bytes, another returns 42KB. Here is how to put an output budget on your hooks.
Claude Code2026-07-10
Carrying Decisions Across Compaction with PreCompact and SessionEnd Hooks
Auto-compaction does not delete your conversation. It deletes the reasons behind it. Here is a working PreCompact / SessionEnd / SessionStart hook pipeline that rescues decisions to disk and hands them to the next session, with real code and measurements.
Claude Code2026-07-01
My Claude Code Hooks Stopped Firing After an Update — the Hyphenated Matcher Exact-Match Change in v2.1.195
In Claude Code v2.1.195, hook matchers containing a hyphen switched from partial match to exact match, silently disabling an existing PreToolUse hook. Here is how I isolated the cause and how to write matchers that won't break.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →