How to use Claude in Codex and GPT in Claude Code
AutoRouter6 min read
AutoRouter, the Mac app for Codex and Claude Code, needs no keys or config: connect your Claude and ChatGPT plans, and your Claude plan runs inside Codex and your ChatGPT plan inside Claude Code. The native routes need a gateway in each app. To use Claude in Codex natively, add a gateway that speaks OpenAI's Responses API, such as OpenRouter, as a provider in ~/.codex/config.toml and set model to a Claude slug. To use GPT in Claude Code, run a gateway such as a LiteLLM proxy with an OpenAI API key and point ANTHROPIC_BASE_URL at it. Both bill per token on a key, outside your subscriptions.
AutoRouter wrote this post, and it competes with the gateways below; they are the better fit if you want API billing or run on Linux or Windows. Every command is copied from OpenAI's, Anthropic's, OpenRouter's or LiteLLM's docs as checked on November 17, 2026; check the linked page before you paste.
Why doesn't Claude work in Codex out of the box?
Each app speaks one API format. Codex sends only OpenAI Responses requests (responses is the only wire_api value, per OpenAI's config reference), and Claude Code sends only Anthropic Messages requests (Anthropic gateway protocol). Anthropic's own OpenAI compatibility layer covers Chat Completions, not Responses, and Anthropic describes it as meant for testing and comparing models rather than production use. So each direction needs something in between that translates.
How do you use Claude in Codex?
Add OpenRouter as a provider in ~/.codex/config.toml and set model to a Claude slug. OpenRouter's Codex guide names ~anthropic/claude-sonnet-latest as one; its model list also has ~anthropic/claude-opus-latest and anthropic/claude-opus-5.5.
- Create an OpenRouter key and buy credits.
- Add
export OPENROUTER_API_KEY="sk-or-..."to your shell profile. - Add the block below to
~/.codex/config.toml, replacing any existingmodelandmodel_providerlines. - Restart Codex and start a session.
model_provider = "openrouter"
model_reasoning_effort = "high"
model = "~anthropic/claude-sonnet-latest"
[model_providers.openrouter]
name = "openrouter"
base_url="https://openrouter.ai/api/v1"
[model_providers.openrouter.auth]
command = "sh"
args = ["-c", "echo $OPENROUTER_API_KEY"]
The auth command lets Codex fetch OpenRouter's model catalog; with a plain env_key, non-OpenAI models show an "Unknown model" warning (OpenRouter: Codex CLI). The Codex app opened from the Dock doesn't see your shell profile, so OpenRouter's Codex app guide sets the key with launchctl setenv OPENROUTER_API_KEY and a full quit and reopen, which lasts until you log out. OpenRouter bills inference at the provider's list price and charges 5.5% when you buy credits on its Standard plan (OpenRouter pricing). Your Claude plan doesn't pay for these requests.
How do you use GPT in Claude Code?
Run LiteLLM's proxy with your OpenAI API key and point Claude Code at it. LiteLLM's guide for non-Anthropic models in Claude Code lists the GPT models in a config.yaml:
model_list:
# OpenAI gpt-6.1-sol
- model_name: gpt-6.1-sol
litellm_params:
model: openai/gpt-6.1-sol
api_key: os.environ/OPENAI_API_KEY
# OpenAI gpt-6-luna
- model_name: gpt-6-luna
litellm_params:
model: openai/gpt-6-luna
api_key: os.environ/OPENAI_API_KEY
Then install and start the proxy, and start Claude Code against it:
uv tool install 'litellm[proxy]'
export OPENAI_API_KEY="your-openai-api-key"
export LITELLM_MASTER_KEY="sk-<paste-a-long-random-key>"
litellm --config /path/to/config.yaml
# in a new terminal
export ANTHROPIC_BASE_URL="http://0.0.0.0:4000"
export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY"
claude --model gpt-6.1-sol
Pass the model with --model or ANTHROPIC_MODEL: Claude Code's gateway model discovery keeps only IDs that contain claude or anthropic, so gpt-6.1-sol won't appear in /model (Anthropic gateway protocol). While the gateway credential is set, it replaces your claude.ai login, and the requests bill per token to the OpenAI key behind the proxy (Anthropic docs). Your ChatGPT plan doesn't pay for them.
How do you run your Claude plan in Codex with AutoRouter?
Connect both plans in AutoRouter and pick the model. AutoRouter, the Mac app for Codex and Claude Code, needs no keys or config. In Codex, OpenAI models run on your ChatGPT plan, and in Claude Code, Claude models run on your Claude plan; connect the other subscription in AutoRouter's settings and your Claude plan runs inside Codex and your ChatGPT plan inside Claude Code. Grok and Gemini plans connect the same way.
- Download AutoRouter for macOS from autorouter.com.
- Open it, sign in or create a free account, and sign in to your Claude and ChatGPT plans.
- Allow Accessibility and click Enable for Codex and for Claude Code.
- Start a new session. In Codex, pick a Claude model from the model menu under the message box; in Claude Code, pick a GPT model with
/model.
The models shown on AutoRouter's site are Claude Fable 5.2, Claude Opus 5.5, Claude Sonnet 5.5 and Claude Haiku 5.5 on the Claude plan, and GPT-6 Astra, GPT-6.1 Sol and GPT-6 Luna on the ChatGPT plan; the full list is on AutoRouter's models page. Choosing a model in the picker sends your requests straight to it.
Choose AutoRouter as the model instead and it works out how hard each task is and sends it to the model that fits, using your plans first. In the landing page's illustration, a change across six files goes to Claude Opus 5.5 on the Claude plan, and a test that only fails on CI goes to GPT-6 Astra on the ChatGPT plan, from whichever app you typed it in. How AutoRouter picks a model covers the rules.
What does it cost to use one plan in the other app?
With AutoRouter, nothing beyond the plans: the Free plan costs $0 a month and connects two subscriptions, such as one Claude plan and one ChatGPT plan. Pro, at $50 a month with $20 of included usage each month, connects any number and adds every other model at the provider's price plus 10%. New accounts get Pro free for their first month, or until $20 of usage is spent, whichever comes first. AutoRouter earns nothing on plans.
When one account reaches its limit, AutoRouter moves on to the account with the most room left before it spends any credit. On Pro, if a ChatGPT or Claude plan runs out, those requests keep going from the monthly usage until the plan resets. The gateway routes bill every request per token instead.
| Route | Direction | Setup | What pays |
|---|---|---|---|
| OpenRouter in Codex | Claude in Codex | Provider block in config.toml, OpenRouter key | OpenRouter credits, plus 5.5% on purchases |
| LiteLLM proxy | GPT in Claude Code | config.yaml, running proxy, OpenAI key | Your OpenAI API key, per token |
| AutoRouter (Mac) | Both directions | Install, connect plans, click Enable | Your Claude and ChatGPT plans; $0 on Free for two subscriptions |
The limits: AutoRouter runs on macOS 14 or later, with the Codex app and CLI and the Claude Code CLI, which needs Node 22.18 or later. Requests pass through AutoRouter's servers; it doesn't store transcripts, but keeps the message that opens each request, up to 4,000 characters, to review routing (AutoRouter privacy). Codex vs Claude Code compares the two apps themselves.
Questions
Which Claude models can I use in Codex with AutoRouter?
Every Claude model your plan covers, picked from Codex's model menu. AutoRouter's site shows Claude Fable 5.2, Claude Opus 5.5, Claude Sonnet 5.5 and Claude Haiku 5.5 on the Claude plan, and the lineup changes; AutoRouter's models page lists them all.
Can I point Codex at Anthropic's OpenAI-compatible endpoint?
Not as documented. Codex needs the Responses API, and Anthropic's compatibility layer documents Chat Completions only (Anthropic: OpenAI SDK compatibility). A gateway such as OpenRouter or LiteLLM sits between them.
Why doesn't gpt-6.1-sol show up in /model?
Claude Code's gateway model discovery keeps only model IDs that contain claude or anthropic. Start Claude Code with --model gpt-6.1-sol, set ANTHROPIC_MODEL, or add it as ANTHROPIC_CUSTOM_MODEL_OPTION (Claude Code model configuration).
What happens when my Claude plan runs out mid-task in Codex?
AutoRouter moves on to the connected account with the most room left before it spends any credit. On Pro, the task keeps going from the monthly usage until the plan resets, and AutoRouter asks you to top up if that runs out too. OpenRouter alternatives compares this with gateways that bill per token.
Sources
- AutoRouter
- AutoRouter models
- AutoRouter privacy
- Codex configuration reference
- Anthropic: OpenAI SDK compatibility
- OpenRouter: Codex CLI
- OpenRouter: Codex app
- OpenRouter pricing
- LiteLLM: Claude Code with non-Anthropic models
- Claude Code: LLM gateways
- Claude Code: gateway protocol
- Claude Code: model configuration