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

  1. Open Add providerIn magpie’s Providers tab, press + Add provider.
  2. 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:

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:

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.

Only some sessions on GPT? Leave Claude Code unconnected in magpie and run 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:

TierVariable in envBy default
opusANTHROPIC_DEFAULT_OPUS_MODELThe GPT model you picked
sonnetANTHROPIC_DEFAULT_SONNET_MODELThe GPT model you picked
haikuANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_SMALL_FAST_MODELThe GPT model you picked
fableANTHROPIC_DEFAULT_FABLE_MODELLeft 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:

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.

Several accounts and failover

The routing modes are in Get started.

Switch back

Pick one of Claude Code’s own models on its row, or run:

Terminal
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.

Your claude.ai sign-in. On a magpie model, Claude Code’s sign-in setting is magpie’s key by default: claude.ai is signed out for it, so /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.

Terminal
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.