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

> Use Auto, the Mac app for all your coding agents: connect the AI subscriptions you already pay for, 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.

Author: Tyler J. Cagle (https://x.com/tjcages)
Published: 2026-11-17T06:16:00.000Z
Updated: 2026-11-20T15:20:00.000Z
Reading time: 7 min
Canonical: https://auto.sh/blog/claude-in-codex-and-gpt-in-claude-code
Part of: How to choose and change models in Codex and Claude Code (https://auto.sh/blog/models-in-codex-and-claude-code.md)
Publisher: Auto (https://auto.sh)

![Auto 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: Auto, both plans connected. Source: Codex, Claude Code, OpenRouter and LiteLLM docs, and Auto, read November 17, 2026.](https://auto.sh/blog/images/claude-in-codex-and-gpt-in-claude-code/1-routes.png)

[Auto, the Mac app for all your coding agents](https://autorouter.com/), needs no keys or config: connect the AI subscriptions you already pay for, 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.

Auto 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 Auto?

Connect both plans in Auto and pick the model. Auto 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 Auto's settings and your Claude plan runs inside Codex and your ChatGPT plan inside Claude Code. Grok plans connect the same way. The same plans run in Cursor's own Agent; [How to use Claude Code in Cursor](/blog/claude-code-in-cursor) and [How to use Codex in Cursor](/blog/codex-in-cursor) have the steps, and [How to use Codex in Claude Code](/blog/codex-in-claude-code) covers OpenAI's Codex plugin.

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

1. Download Auto 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 ([Codex setup](/integrations/codex), [Claude Code setup](/integrations/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 Auto'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 [Auto'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 Auto, 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](/pricing), which includes usage each month, connects any number and adds every other model at the provider's price plus 10%. New accounts get a week of Pro, or until its included usage is spent, whichever comes first. Auto earns nothing on plans.

When one account reaches its limit, Auto moves on to the account with the most room left before it spends any credit. On Pro, if a connected 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                                  |
| Auto (Mac)          | Both directions    | Install, connect plans, click Enable            | Your Claude and ChatGPT plans; $0 on Free for two subscriptions |

The limits: Auto runs on macOS 14 or later and works with all your coding agents (Claude Code, Codex, Cursor, etc.); Claude Code needs Node 22.18 or later. Requests pass through Auto's servers; it doesn't store transcripts, but keeps the message that opens each request, up to 4,000 characters, to review routing ([Auto privacy](https://autorouter.com/privacy)). [Codex vs Claude Code](/blog/codex-vs-claude-code) compares the two apps themselves.

If you already run a translator for Claude Code, see [claude-code-proxy vs Auto](/compare/claude-code-proxy). If you already use a compatible proxy, you can [migrate from claude-code-proxy](/switch/claude-code-proxy) without starting over.

## Questions

### Which Claude models can I use in Codex with Auto?

Every Claude model your plan covers, picked from Codex's model menu. Auto'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; [Auto'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?

Auto 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 Auto asks you to top up if that runs out too. [OpenRouter alternatives](/blog/openrouter-alternatives) compares this with gateways that bill per token.

## Sources

- [Auto](https://autorouter.com/)
- [Auto models](https://autorouter.com/models)
- [Auto 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://auto.sh/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 Auto, the Mac app for all your coding agents, adds it to config.toml after saving a copy of the file, and disabling it switches Codex back.
- [How to choose and change models in Codex and Claude Code](https://auto.sh/blog/models-in-codex-and-claude-code.md): To give each task the right model, use Auto, the Mac app for all your coding agents: it adds models from every leading provider to the picker you already use (Claude Code, Codex, Cursor, etc.) and can pick one for each turn. To choose yourself, give hard, multi-file work a frontier model such as Claude Opus 5.5 or GPT-6.2 Astra and quick edits a fast one such as Claude Haiku 5.5 or GPT-6 Luna. Switch with /model in either app, a launch flag for one session, or a settings file for every session.
- [How to use Codex in Cursor](https://auto.sh/blog/codex-in-cursor.md): Use Auto, the Mac app for all your coding agents, to run your ChatGPT plan inside Cursor's own Agent: connect the plan, enable Cursor, restart it, and new chats start on Auto. To run Codex itself in Cursor, install OpenAI's Codex extension (`openai.chatgpt`) from Cursor's Extensions view, open the Codex sidebar and sign in with ChatGPT; it runs on your ChatGPT plan's Codex limits, from Plus up. Without either, Cursor's Agent bills GPT models from prepaid credit at API list price.

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

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

Auto is a Mac app for AI model routing in Codex, Claude Code, Cursor and other supported coding agents. It uses eligible connected subscriptions first. See [setup](https://auto.sh/setup.md) and [pricing](https://auto.sh/pricing).
