# How to use Claude in Codex and GPT in Claude Code

Authors: AutoRouter
Author profile: https://autorouter.com/about
Published: 2026-11-17T06:16:00.000Z
Reading time: 6 min
Canonical: https://autorouter.com/blog/claude-in-codex-and-gpt-in-claude-code
Publisher: AutoRouter, the Mac app that routes Codex, Claude Code and other AI tools to every model (https://autorouter.com)

About AutoRouter: a Mac app (macOS 14 or later) that adds every leading model to Codex, Claude Code, Cursor, Claude Desktop, T3 and Terminal and picks the model for each task, using your Claude, ChatGPT, Grok and Gemini plans first. Install from https://autorouter.com/AutoRouter.dmg, or ask your agent to follow https://autorouter.com/setup.md. Routing across your plans is free; Pro is $50 a month with $20 of included usage. Unrelated to OpenRouter's Auto Router.

> Use AutoRouter, the Mac app for Codex and Claude Code: connect your Claude and ChatGPT plans, and your Claude plan runs inside Codex and your ChatGPT plan inside Claude Code, with no keys or config. The Free plan connects two subscriptions for $0 a month. Natively, Claude in Codex takes a Responses-compatible gateway such as OpenRouter in `config.toml`, and GPT in Claude Code takes a gateway such as a LiteLLM proxy behind `ANTHROPIC_BASE_URL`; both bill per token on a key.

![AutoRouter runs each plan in the other app. What do you want to run? Goal Claude in Codex: OpenRouter key, billed per token; Goal GPT in Claude Code: LiteLLM or OpenRouter, per token; Goal Either, on your plans: AutoRouter, both plans connected. Source: Codex, Claude Code, OpenRouter and LiteLLM docs, and AutoRouter, read November 17, 2026.](https://autorouter.com/blog/images/claude-in-codex-and-gpt-in-claude-code/1-routes.png)

[AutoRouter, the Mac app for Codex and Claude Code](https://autorouter.com), 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](https://openrouter.ai/docs/cookbook/coding-agents/codex-cli), 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](https://docs.litellm.ai/docs/tutorials/claude_non_anthropic_models) 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](https://learn.chatgpt.com/docs/config-file/config-reference)), and Claude Code sends only Anthropic Messages requests ([Anthropic gateway protocol](https://code.claude.com/docs/en/llm-gateway-protocol)). Anthropic's own [OpenAI compatibility layer](https://platform.claude.com/docs/en/api/openai-sdk) 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`.

1. Create an OpenRouter key and buy credits.
2. Add `export OPENROUTER_API_KEY="sk-or-..."` to your shell profile.
3. Add the block below to `~/.codex/config.toml`, replacing any existing `model` and `model_provider` lines.
4. Restart Codex and start a session.

```toml
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](https://openrouter.ai/docs/cookbook/coding-agents/codex-cli)). The Codex app opened from the Dock doesn't see your shell profile, so OpenRouter's [Codex app guide](https://openrouter.ai/docs/cookbook/coding-agents/codex-desktop) 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](https://openrouter.ai/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`:

```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:

```bash
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](https://code.claude.com/docs/en/llm-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](https://code.claude.com/docs/en/llm-gateway)). 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.

![Claude in Codex, paid by your Claude plan. 1. Connect both plans (Claude and ChatGPT); 2. Enable Codex (In AutoRouter); 3. Pick a Claude model (Codex's model menu); 4. Claude plan runs it (No API key). Source: AutoRouter setup and FAQ, read November 17, 2026.](https://autorouter.com/blog/images/claude-in-codex-and-gpt-in-claude-code/2-plan-flow.png)

1. Download AutoRouter for macOS from [autorouter.com](https://autorouter.com).
2. Open it, sign in or create a free account, and sign in to your Claude and ChatGPT plans.
3. Allow Accessibility and click Enable for Codex and for Claude Code.
4. 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](https://autorouter.com/models). 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](/blog/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](https://autorouter.com/privacy)). [Codex vs Claude Code](/blog/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](https://autorouter.com/models) 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](https://platform.claude.com/docs/en/api/openai-sdk)). 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](https://code.claude.com/docs/en/model-config)).

### 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](/blog/openrouter-alternatives) compares this with gateways that bill per token.

## Sources

- [AutoRouter](https://autorouter.com)
- [AutoRouter models](https://autorouter.com/models)
- [AutoRouter privacy](https://autorouter.com/privacy)
- [Codex configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
- [Anthropic: OpenAI SDK compatibility](https://platform.claude.com/docs/en/api/openai-sdk)
- [OpenRouter: Codex CLI](https://openrouter.ai/docs/cookbook/coding-agents/codex-cli)
- [OpenRouter: Codex app](https://openrouter.ai/docs/cookbook/coding-agents/codex-desktop)
- [OpenRouter pricing](https://openrouter.ai/pricing)
- [LiteLLM: Claude Code with non-Anthropic models](https://docs.litellm.ai/docs/tutorials/claude_non_anthropic_models)
- [Claude Code: LLM gateways](https://code.claude.com/docs/en/llm-gateway)
- [Claude Code: gateway protocol](https://code.claude.com/docs/en/llm-gateway-protocol)
- [Claude Code: model configuration](https://code.claude.com/docs/en/model-config)

## Read next

- [Codex model providers and config.toml, explained](https://autorouter.com/blog/codex-model-providers.md): Codex picks its model from the model key and its endpoint from the model_provider key in ~/.codex/config.toml, and each custom provider is a [model_providers.<id>] table with a base URL, an environment variable for its API key and the Responses wire API. Profiles are separate files loaded with --profile, -c overrides one key for one run, and --oss runs a local Ollama or LM Studio model. Enabling AutoRouter, the Mac app for Codex and Claude Code, adds it to config.toml after saving a copy of the file, and disabling it switches Codex back.
- [How to use MiniMax in Claude Code and Codex](https://autorouter.com/blog/minimax-in-claude-code-and-codex.md): Use AutoRouter, the Mac app for Codex and Claude Code: it puts MiniMax M3.1 Flash in both apps' model pickers with no MiniMax key or config. Natively, set Claude Code's `ANTHROPIC_BASE_URL` to `https://api.minimax.io/anthropic` with your M Plan key and `MiniMax-M3.1-Flash[1m]` model variables in `~/.claude/settings.json`, and add `https://api.minimax.io/v1` as a provider in Codex's `config.toml`.
- [How to use Kimi in Claude Code and Codex](https://autorouter.com/blog/kimi-in-claude-code-and-codex.md): Use AutoRouter, the Mac app for Codex and Claude Code: it puts Kimi K3.1 Pro in both apps' model pickers with no Kimi account, key or config. Natively, set Claude Code's `ANTHROPIC_BASE_URL` to Moonshot's `https://api.moonshot.ai/anthropic` (or `https://api.kimi.ai/coding/` with a Kimi Code plan) with your key and model variables in `~/.claude/settings.json`, and add `https://api.moonshot.ai/v1` as a provider with `kimi-k3.1-pro` in Codex's `config.toml`.

Tags: [Guides](https://autorouter.com/blog/tags/guides.md), [Models](https://autorouter.com/blog/tags/models.md), [Codex](https://autorouter.com/blog/tags/codex.md)

Drafted with AI from the sources linked above, then checked and edited by the AutoRouter team.
