How to switch AI model mid conversation without losing context
You can switch AI model mid conversation in Claude Code, Codex and Gemini CLI. What the new model actually receives, what it costs, and how to keep memory.

On this page
Part of How Fluf runs Claude Code with your own login (2026 rules)
You can switch AI model mid conversation in every major coding agent: /model in Claude Code, Codex and Gemini CLI. The conversation carries on. What changes is what the new model actually reads, what that first reply costs, and what you lose when the history is too long to pass over whole. This article explains each, then shows how to switch across vendors (Claude to GPT to a local model) without your agent forgetting who it is.
Why switch at all
Four reasons come up every week:
- The window ran out. Your Claude plan's five-hour limit hits in the middle of a refactor. You want to finish on Codex, not start over.
- The job changed. Planning wants your strongest reasoning model. Renaming 40 files does not.
- Cost. A cheap fast model for the boring tail of a task can cut the bill by an order of magnitude.
- Privacy. The next step touches customer data you would rather keep on a local model.
How switching works inside one CLI
Claude Code. /model with no argument opens a picker; Option+P (macOS) or Alt+P switches too. Per Anthropic's commands reference, /model saves your choice as the default for new sessions; press s on a row to switch for the current session only. Claude Code "uses the new model from the next request it makes in that turn." The catch is in the prompt caching docs: "Switching with /model means the next request reads the entire conversation history with no cache hits, even though the content is identical." One slower, pricier turn, then caching resumes.
Codex. "In an interactive CLI session, use /model to switch models or adjust reasoning effort" (Codex models). Effort runs from Light to Extra High, plus Max and Ultra on models that have them, so switching effort is often enough.
Gemini CLI. /model opens a dialog, and the change applies "to all subsequent interactions" (Gemini CLI model docs). One quirk: it "does not override the model used by sub-agents."
That is the real limit. Each CLI switches within its own vendor's models. Claude Code will not hand your conversation to GPT, and Codex will not hand it to Claude.
What the new model actually gets
When you switch, the new model starts cold. It knows only what it is sent. There are three honest options, each with a trade-off:
| Handover | What the new model reads | Speed of first reply | Risk |
|---|---|---|---|
| Full history | Every message so far | Slow, and uncached | Hits the context limit on long threads |
| Smart summary | A summary, plus search over the whole history | Fast | Detail must be looked up, not assumed |
| Short brief | A one-page handover written by the old model | Fastest, cheapest | Whatever the brief leaves out is gone |
Long conversations add a twist. When a thread outgrows the context window, tools compact it: Claude Code's /compact summarises "the conversation so far," and auto-compaction does it for you. After compaction, "full history" already means "summary plus recent turns." That is why facts you want every model to know should not live only in chat. Put them in an instruction file (CLAUDE.md, AGENTS.md, GEMINI.md) or in memory.
- 1Decide whenAfter this reply, or stop now
- 2Decide whatSummary, full history or brief
- 3SwitchSame agent, new model
- 4Keep memoryFacts live outside the chat
Switching across vendors without losing context
To move one conversation from Claude to GPT to a local Llama, you need something above the CLIs that owns the conversation and the memory. That is what Fluf does.
Fluf is a desktop app for Mac, Windows and Linux where you hire AI agents with a name, a memory and routines. Each agent has its own model, from any connection you have: your installed Claude Code or Codex signed in with your own login, an API key from Anthropic, OpenAI, Google, xAI, OpenRouter and 30+ more, or a local model through Ollama or LM Studio. Switch any agent at any time; it keeps its name, memory and history (Models, effort and speed).
Two settings in App settings › Models decide how it goes.
When you switch a busy agent:
- After the current reply (the default): finishes, then switches.
- Ask me: offers After this reply or Stop and switch now.
- Stop and switch now: switches immediately.
What the new model gets:
- Smart (Recommended): a summary, plus the ability to look up anything from the whole conversation.
- Carry the full history: the new model reads everything. Slower first reply, nothing lost.
- Start from a short brief: the agent writes a one-page handover. Fast and cheap.
The same rules apply when a plan runs out on its own. With Continue on an API key on, agents move to a key you chose and switch back when the window resets. With two logins of the same app on Pro, agents move to the next one with usage left and carry on in the same conversation. (Fluf never switches between ChatGPT accounts: OpenAI's rules forbid it.)
Memory makes switching safe
The deeper fix is to stop relying on the transcript. Fluf agents keep a persistent memory: facts, preferences and decisions scoped to one agent, a team, a business or you. Memory belongs to the agent, not the model, so a switch from Claude to GLM to a local Llama changes nothing about what the agent knows. You can open any memory in the Library, edit it or make the agent forget it (Memory).
Four mistakes that make a switch go wrong
Switching mid tool call. Stopping an agent halfway through a file edit or a migration leaves work in an unknown state. Switch after the reply unless the agent is clearly going the wrong way.
Passing the full history out of habit. On a thread with hundreds of turns, the new model spends its first reply, and your money, rereading things that no longer matter. A smart summary with search is the better default.
Trusting a brief for exact details. A one-page handover is perfect for "carry on with step 4". It is the wrong choice when step 4 depends on an exact error message from an hour ago.
Keeping decisions only in chat. "We use UTC everywhere" said once in message 37 will not survive two compactions and a vendor switch. Write it down where every model reads it: an instruction file or the agent's memory.
Which model for which part of the job
A pattern that works for most developers:
- Plan on your strongest reasoning model at high effort.
- Execute mechanical steps on a fast, cheap model.
- Review back on the strong model, reading the diff, not the whole history.
- Private steps on a local model.
For picking between the two big coding agents, see Claude Code vs Codex. For what Anthropic allows when your agents run on your own plan, read our pillar on running AI employees on your Claude subscription.
Download Fluf and switch any agent between Claude, GPT and local models without it forgetting a thing.
Questions people ask
- Does switching models in Claude Code lose the conversation?
- No. /model changes the model for the next request and the conversation carries on. Anthropic's prompt caching docs note the first request after a switch reads the whole history with no cache hits, so that one turn is slower and costs more.
- Can I switch from Claude to GPT in the same conversation?
- Not inside one vendor's CLI: Claude Code offers Claude models and Codex offers OpenAI models. To move one conversation across vendors you need a layer above both. In Fluf, an agent keeps its history and memory and can switch between Claude Code, Codex, API key and local models.
- Why does the new model forget things after a switch?
- Usually because it did not receive them. Long conversations get compacted into summaries, and some tools hand the new model only a summary. Durable facts belong in memory or an instruction file, not only in chat history, so every model reads them.
- Is it cheaper to start a new chat than to switch models?
- Often, for long conversations. The new model must read whatever history you pass it, uncached. A short written brief is fast and cheap; the full history is slow and complete. Pick by how much the next step depends on detail.
Sources
- Claude Code: Commands, checked 27 November 2026
- Claude Code: Prompt caching, checked 27 November 2026
- Claude Code: Interactive mode, checked 27 November 2026
- Codex: Models, checked 27 November 2026
- Gemini CLI: Model selection, checked 27 November 2026



