Docs · Guide
Use your ChatGPT Plus or Pro subscription in Claude Code
Claude Code can run on the GPT models of your ChatGPT Plus or Pro plan. Sign in to ChatGPT in magpie, pick a codex/… model for Claude Code, and keep working as before. No OpenAI API key.
Claude Code speaks Anthropic’s Messages API. magpie runs a gateway on your computer, at 127.0.0.1:3425, that translates each of Claude Code’s requests for the GPT model and each reply back, streaming and tool calls included. magpie writes the gateway’s address and key into Claude Code’s settings.json, and your ChatGPT sign-in stays in magpie.
Sign in to ChatGPT
- Open Add providerIn magpie’s Providers tab, press + Add provider.
- Click the ChatGPT tilemagpie opens OpenAI’s own sign-in page in your browser. The account shows up as soon as you finish.
Or from a terminal:
magpie accounts add codex # sign in to a ChatGPT account
The account’s models are codex/….
Pick a GPT model for Claude Code
In the Agents tab, click the model on Claude Code’s row and choose a codex/… model. From a terminal:
magpie models # every model, as provider/model magpie claude codex/gpt-5.5
Inside Claude Code, /model lists magpie’s models too, marked “via magpie”, so you can switch there.
claude-magpie when you want it on a GPT model. It starts the same claude with magpie’s settings for that session only, and settings.json is not rewritten.How Opus, Sonnet and Haiku map
Claude Code asks for models by tier: opus, sonnet, haiku and fable. Its own small jobs, such as a session’s title and Explore subagents, go to the haiku tier. With a GPT model as the main model:
| Tier | Variable in env | By default |
|---|---|---|
| opus | ANTHROPIC_DEFAULT_OPUS_MODEL | The GPT model you picked |
| sonnet | ANTHROPIC_DEFAULT_SONNET_MODEL | The GPT model you picked |
| haiku | ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_SMALL_FAST_MODEL | The GPT model you picked |
| fable | ANTHROPIC_DEFAULT_FABLE_MODEL | Left unset |
To give a tier a model of its own, say a smaller one for haiku, set it on Claude Code’s row in magpie, or from a terminal:
magpie claude haiku codex/… # one tier on its own model magpie claude haiku "" # back to the main model
Reasoning effort
The effort Claude Code asks for goes to the GPT model as its reasoning effort, on requests where Claude Code has thinking on. magpie also tells Claude Code which effort levels each model has.
To hold one effort whatever Claude Code asks, set effort on Claude Code’s row. opus effort, sonnet effort, haiku effort, fable effort and subagent effort set it per tier. Each starts at the effort Claude Code asks for. An open Claude Code session keeps the effort it started with, so restart it to use a new one.
Limits and usage
Requests are served on your ChatGPT account, so they count toward your plan’s usage limits, as Codex’s own requests do.
- See what’s used. Turn on status line on Claude Code’s row: it shows the 5h and 7d use of the accounts magpie serves, under Claude Code’s prompt.
magpie accountslists each account and how much of its allowance is used. The Usage tab has the history. - When an account runs out. magpie sets it aside until the reset OpenAI’s refusal names, else until its full window renews, else for 5 hours, and sends requests to your next account or the provider’s Fallback. The account comes back on its own once its window renews.
Several accounts and failover
- Add another account. Click the ChatGPT tile again, or run
magpie accounts add codexagain. Each account is listed under the provider. - Spread requests over them. Open the provider’s row and tick every account to use. Smart routing, the default, sends requests to the account with quota to spare whose allowance renews soonest.
- Fall back to another model. The provider’s Fallback lists models to use when every account is out, rate limited or down, a model from another subscription or an API key included.
The routing modes are in Get started.
Switch back
Pick one of Claude Code’s own models on its row, or run:
magpie claude default
That takes magpie’s wiring out of Claude Code and puts back what it had. Disconnect on Claude Code’s row does the same.
/usage plan limits, connectors, voice and /teleport are off. Set it to claude.ai to keep them.The other way round: Claude in Codex
A Claude Pro or Max subscription works in Codex the same way. Sign in to Claude in magpie and pick a claude/… model for Codex. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.
magpie accounts add claude magpie codex claude/claude-opus-5-5
See Models in Codex and Subscriptions in any agent.
FAQ
Can I use my ChatGPT Plus or Pro subscription in Claude Code?
Yes. Sign in to ChatGPT in magpie and pick a codex/… model on Claude Code’s row, or run magpie claude codex/gpt-5.5. magpie translates Claude Code’s requests for the GPT model and the replies back, tool calls included.
Do I need an OpenAI API key?
No. magpie signs in on OpenAI’s own page, and Claude Code gets the gateway’s key. Your sign-in stays in magpie.
Does it use my ChatGPT plan’s limits?
Yes. Requests are served on your ChatGPT account and count toward its usage limits. magpie’s status line shows each account’s 5h and 7d use under Claude Code’s prompt.
Which model do Claude Code’s Haiku requests use?
The GPT model you picked, unless you give the haiku tier a model of its own with magpie claude haiku <model>.
How do I go back to Claude’s own models?
Run magpie claude default, or pick one of Claude Code’s own models on its row in magpie.
Do my requests go through a magpie server?
No. The gateway runs on your computer. Requests go from it to OpenAI; magpie has no server of its own in that path.
Using an API key instead? See Models in Claude Code. Something fails? See Fixing common errors, or ask on Discord.