---
title: "Switch Claude Code Providers In Chat — \"Use My Local One\""
description: "Configure providers once, then switch backends from inside Claude Code with natural language. ToolPiper's endpoint_set MCP tool reroutes the session — no env vars, no restart."
canonical: "https://modelpiper.com/recipes/claude-code-cross-provider/"
---

# Switch Claude Code Providers In Chat — "Use My Local One"

> Configure providers once, then switch backends from inside Claude Code with natural language. ToolPiper's endpoint_set MCP tool reroutes the session — no env vars, no restart.

[![ModelPiper](model-piper-logo-sm.svg)ModelPiper](/)

[Compare](/compare/claude-code-backends)[Docs](/docs/toolpiper)[Download ToolPiper](https://modelpiper.com/download)

Conversational · MCP-native · One-of-a-kind

# Switch providers from inside Claude Code.

Set up your providers once. Then say "switch to my local Qwen" or "use OpenAI for this" — Claude Code calls ToolPiper's endpoint\_set MCP tool and the next prompt routes through the new backend. No env vars, no shell restart, no editor restart.

## Before you start

-   Two or more providers configured in ToolPiper (any combination of Apple Intelligence, llama.cpp, OpenAI, Anthropic, Gemini, Groq, etc.).
-   Claude Code installed.
-   ToolPiper installed and connected to Claude Code (run any of the other recipes first).

## Setup

1.  1
    
    ### Confirm both endpoints are wired
    
    In ToolPiper → Endpoints, you should see at least two entries — for example "Apple Intelligence (local)" and "OpenAI gpt-4o-mini (your key)". Both must be enabled. Open Claude Code and type `/model` to confirm both appear in the picker.
    
2.  2
    
    ### Pick a starting endpoint
    
    In Claude Code's `/model` picker, pick whichever you want as the default for this session. From here on, Claude Code routes through that endpoint until you say otherwise.
    
3.  3
    
    ### Try natural-language switching
    
    In the chat itself — not the slash-command picker — say one of these:
    
    chat
    
    ```
    "Switch to my local Qwen one."
    "Try Apple Intelligence for this."
    "Use my OpenAI endpoint."
    "What model am I using right now?"
    ```
    
4.  4
    
    ### Watch ToolPiper handle the switch
    
    Behind the scenes: Claude Code parses your sentence, calls ToolPiper's `endpoint_set` MCP tool with `scope: "session"`, ToolPiper updates the dev-token binding, and the next prompt routes through the new backend. No restart, no env-var change, no settings edit.
    
5.  5
    
    ### Let ToolPiper recommend
    
    Hit a long-context problem? Say _"I need more context for this."_ Claude Code calls `endpoint_recommend` — ToolPiper looks at your conversation size, your endpoints' context windows, and your recent latency telemetry, then auto-applies the right backend with a verbatim notice you can override.
    

## Why this recipe

### No friction, no jargon

Users don't learn API surfaces. They say "use my local one" and it works. ToolPiper makes the routing decision; the model surfaces it back in plain English.

### ToolPiper sees both sides

Vanilla Anthropic doesn't know about your local Qwen. Vanilla Ollama doesn't know about your OpenAI key. ToolPiper sees both and reasons across them — context fit, capability, latency, free-vs-paid.

### Conversation continues

Your chat history, system prompt, and tool definitions stay intact across the switch. Only the inference backend changes; the model on the other side picks up where the last one left off.

## Frequently asked

How does ToolPiper know which endpoint I mean?

You give them human-readable names ("Apple Intelligence (local)", "OpenAI gpt-4o-mini"). When you say "use my local one", Claude Code passes the request to <code class="font-mono text-xs text-white/70">endpoint\_set</code> with the name; ToolPiper matches it. If you're ambiguous ("switch the model"), ToolPiper calls <code class="font-mono text-xs text-white/70">endpoint\_list</code> and Claude Code asks which one.

What about cost? Won't Claude Code accidentally route expensive prompts to OpenAI?

Two safeguards. (1) ToolPiper's default-endpoint setting is a single dropdown — it's the default until you switch. Switches are explicit. (2) <code class="font-mono text-xs text-white/70">endpoint\_recommend</code> includes a "local first" tiebreaker; if the local model fits, it's suggested even when OpenAI would also work.

Can I lock a specific shell to one endpoint?

Yes. Create a per-token binding in ToolPiper → Docs → Claude Code → Tokens. Bind that token to a specific endpoint, then export it in the shell as <code class="font-mono text-xs text-white/70">ANTHROPIC\_API\_KEY</code> instead of using the default. Different shells, different backends, no cross-talk.

Does the switch survive across Claude Code launches?

Session-scope switches reset on next launch (clean slate). Global-scope switches persist — say "switch to my local one for everything" and Claude Code passes <code class="font-mono text-xs text-white/70">scope: "global"</code> to <code class="font-mono text-xs text-white/70">endpoint\_set</code>. ToolPiper writes it to the global "Anthropic Proxy Backend" setting; survives restarts.

## Ready to try it?

ToolPiper is a free download. Configure once and Claude Code routes through your Mac.

[Download ToolPiper](https://modelpiper.com/download)[Open Setup Guide](/docs/toolpiper#claude-code)

## Other Claude Code recipes

[

### Apple Intelligence (free)

/claude-code-apple-intelligence](/recipes/claude-code-apple-intelligence)[

### Local Qwen via llama.cpp

/claude-code-local-qwen](/recipes/claude-code-local-qwen)[

### BYOK OpenAI

/claude-code-byok-openai](/recipes/claude-code-byok-openai)
