Search the documentation
10 pages for premodelswitch.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
Intercept and control agent behavior with hooks
Claude Code CLI · in the page
agent-sdk/hooks
…| | [`PreModelSwitch`](/docs/en/hooks#premodelswitch) | No | Yes | A requested model switch, before it happ…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…gentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PreModelSwitch" | "PostModelSwitch" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreat…
Claude Code changelog
Claude Code CLI · in the page
changelog
…e> <Update label="2.1.251" description="August 28, 2026"> * Added `PreModelSwitch` and `PostModelSwitch` hook events (block, confirm, or annotate a model switch); `SessionStart` resume hooks now re…
Error reference
Claude Code CLI · in the page
errors
…| | `Model switch ... blocked by a PreModelSwitch hook`…
Hooks reference
Claude Code CLI · in the page
hooks
…dChanged, FileChanged, and DirectoryAdded as standalone async events, PreModelSwitch as a standalone sequential event that runs before a requested model switch, PostModelSwitch as a standalone async e…
Automate actions with hooks
Claude Code CLI · in the page
hooks-guide
…| | `PreModelSwitch` | Before Claude Code applies a model switch that you or a client requested. Can block the switch…
Model configuration
Claude Code CLI · in the page
model-config
…variables the host overrides. If you or your organization configure [PreModelSwitch hooks](/docs/en/hooks#premodelswitch), they run before a requested switch applies and can block it or ask you to co…
Plugins reference
Claude Code CLI · in the page
plugins-reference
…| | `PreModelSwitch` | Before Claude Code applies a model switch that you or a client requested. Can block the switch…
How Claude Code uses prompt caching
Claude Code CLI · in the page
prompt-caching
…d expired. You can also require this confirmation or skip it with a [PreModelSwitch hook](/docs/en/hooks#premodelswitch-decision-control). The [`opusplan` model setting](/docs/en/model-config#opuspl…
Week 36 · August 31 – September 4, 2026
Claude Code CLI · in the page
whats-new/2026-w36
…<div className="digest-wins-grid"> <div>A <a href="/docs/en/hooks#premodelswitch"><code>PreModelSwitch</code></a> hook can block a model switch you request, and a <a href="/docs/en/hooks#postmodel…