You can connect GPT to Claude Code through the local Claude Code Router (CCR) proxy, but it’s an experiment. The proxy accepts requests from the Claude harness and passes them to the OpenAI model you’ve chosen. For the terminal you set up a profile or environment variables; for Claude Desktop, a launch profile or Third-Party Inference. Success is checked in the request log and by whether tools work.
This way you can keep your project open and your usual way of working while swapping the model behind the harness. The CCR developer describes setting up both the terminal and Desktop, but Anthropic says plainly that it doesn’t support routing to other vendors’ models. Below is a step-by-step guide for testing, not a guarantee that any GPT will cope with all of Claude’s tools.
This material was checked against the documentation on 30 October 2026. We haven’t run the whole setup end to end ourselves: check the field names, the available models and the behaviour of your version on your own computer.
How GPT works inside the Claude Code harness
Claude Code isn’t the language model itself but a program that works with it: it reads the project, suggests edits, calls tools and manages the conversation. CCR accepts its requests, translates them into another provider’s format and passes the replies back.
In our case you get a chain: Claude Code, then the local CCR, then OpenAI. The interface stays familiar, while the model behind the gateway changes.
There’s an important difference between the two ways of connecting:
| Method | What’s used | What you pay for |
|---|---|---|
| OpenAI API through CCR | An API key from a separate OpenAI project | API requests; this spending isn’t linked to a ChatGPT subscription |
| Importing Codex into CCR | The saved account authorisation | If the request is accepted, the quota of that account; whether such a transfer is permitted needs a separate assessment |
For a first try it’s more sensible to use an API key: it’s easier to see where a request went and where the spending is counted. If the ChatGPT subscription specifically matters to you, read the next section first.
Spending is worth assessing across the whole task, including context and tool calls. Where to look for unnecessary costs is covered in the token-saving checklist for AI agents.
A ChatGPT subscription in Claude Code: what about authorisation
The official Codex supports signing in with ChatGPT. And CCR, according to the project’s documentation, can import that sign-in: it reads the local Codex authorisation file and model cache, creates a Codex API provider and works over the openai_responses protocol.
But the fact that the import works technically doesn’t mean you’re allowed to use the subscription this way. The Sign in with ChatGPT terms allow you to use the plan only in the app you connected, and forbid using it to open general API access to other tools. A proxy that hands the Codex sign-in to the Claude harness sits poorly with these terms. Nobody can say in advance whether your account will be blocked for this, but the risk is yours.
Don’t paste your ChatGPT password, cookies or the contents of auth.json into the API key field. Don’t share this data in a chat, a public issue or with someone else’s “setup helper”.
CCR, Codex CLI or the plugin: which method to choose
The main guide below is about the local CCR proxy and swapping the model. The other options are useful for a different task: getting a GPT answer without moving Claude’s whole agent loop onto someone else’s API.
| Option | Who runs the work | When to choose it |
|---|---|---|
| CCR | The Claude Code harness, with a GPT model behind the gateway | You specifically need to swap the model in the familiar harness |
| Codex CLI on its own | Codex | You need GPT on a ChatGPT subscription, without a proxy |
Calling codex exec from Claude Code |
Claude, with a separate assignment for Codex | You need a one-off answer or a second opinion through the CLI |
| The official OpenAI plugin | Claude with Codex tools | You need review commands and management of assignments |
| Another gateway, for example LiteLLM | The Claude Code harness, with a model behind the gateway | You already have infrastructure for another proxy |
Practical examples of the CLI and the plugin come after the main CCR guide.
What you need before connecting GPT
You’ll need Claude Code or Claude Desktop installed, CCR for your system and access to the model you’ve chosen. If Claude isn’t set up yet, start with installation and first tasks in Claude Code for beginners.
Save your current work. Make a copy of your user ~/.claude/settings.json: that’s where the /model command writes the model choice. If you’re going to change the project settings too, copy .claude/settings.json and .claude/settings.local.json in its folder as well. Write down your current Third-Party Inference settings in Desktop. The copies may contain secrets, so don’t put them in a repository.
For testing, use a separate folder with one non-secret text file. Move on to a working project only after you’ve checked the route and the tools.
In the terminal you can check the versions:
claude --version
codex --version
Codex is needed for importing the sign-in or for the official plugin covered below. If you use the ordinary OpenAI API through CCR, you don’t need it.
How to connect GPT to Claude Code through CCR
Step 1. Install CCR on Windows or macOS
Windows
Download the Windows build from the Claude Code Router releases and launch the app. If Claude Code already works in your terminal, there’s no need to reinstall it. If you only need the graphical interface, use your installed Claude Desktop.
The Windows commands below are meant for PowerShell 7. Don’t paste the macOS blocks into it: the syntax is different.
macOS
On the same releases page, choose the build for Apple Silicon or Intel. The processor type is shown under Apple menu — About This Mac. Open CCR the usual way; it’s not worth switching off macOS protection globally for the sake of this experiment.
On both systems CCR needs internet access: it sends the requests to the OpenAI cloud anyway. A local proxy doesn’t turn a cloud GPT into a model that works offline.
Step 2. Add an OpenAI model to CCR
In CCR open Providers and click Add Provider. In the preset field choose OpenAI and add your project’s API key. Presets hide the address field; you can view and change it under Advanced settings. For the official OpenAI API the address is https://api.openai.com/v1. Don’t send your OpenAI API key to some random service just because it calls itself OpenAI-compatible.
Choose one model available to your project. Let CCR detect the supported protocol, then run Check Connection for the chosen model only. The check sends a real request and may cost money. A model being in the catalogue doesn’t mean the key has access to it. The setup procedure is described in the CCR documentation.
If you’re testing the Codex import anyway
First you need the official Codex sign-in. If you have Node.js and npm, the commands are the same for PowerShell and Terminal:
npm install -g @openai/codex
codex login
codex login status
Complete the sign-in in the browser. Then go back to CCR, to Providers and Add Provider. If CCR finds the local sign-in, according to the documentation a Codex import should appear there. After importing, check the Codex API provider and whether the chosen model is available.
If the import doesn’t appear, don’t extract the tokens by hand. Codex may keep its authorisation in the system credential store, and whether a particular version of CCR is compatible with that storage method isn’t confirmed here. A successful import on its own also doesn’t lift the restrictions of the terms of use.
Step 3. Start the local CCR proxy
In the Server section set Host to 127.0.0.1, so that the gateway is reachable only from your computer. By default CCR listens on port 3456. On the separate API Keys page click Add API key and create a client key. Then start the server and wait for the Running status.
You’ll get an address like this:
http://127.0.0.1:3456
It’s easy to mix up the two keys here. The OpenAI API key is stored on the CCR side and gives access to the model. The CCR client key is what the Claude harness needs to talk to the local gateway.
Don’t switch on Proxy mode, System proxy or the CA certificate installation. For the connection described here, to an explicit API address, HTTPS interception isn’t needed. These modes change the computer’s network settings and belong to a different way of working. CCR keeps them separate in its server documentation.
Step 4. Create a Claude Code profile with GPT
Open Agent Config — Add Profile and fill in:
| Field | Value |
|---|---|
| Agent | Claude Code |
| Profile name (Config name in some versions) | For example, Claude GPT test |
| Scope (or Effect scope) | Only opened from CCR |
| Entry mode | CLI & APP |
| Model | Your provider and the GPT you’ve chosen |
Save the profile. The terminal button launches the CLI, Play launches the app. While you’re testing, keep the scope limited to launches from CCR. The project itself recommends this order.
Before launching Desktop, save your work and fully quit any Claude that’s already open. On Windows also check the icon in the system tray; on macOS use Quit. Closing one window doesn’t always quit the app.
The profile also has separate model fields by tier: Fable, Opus, Sonnet and Haiku. Claude Code uses the Haiku tier for small, fast requests. If you want those sent to GPT as well, check these assignments: a single main model field doesn’t mean all model traffic goes to OpenAI. CCR describes the tier assignments separately.
GPT in the Claude Code terminal: launching and switching the model
The simplest way is to open the CLI with the button of the profile you created. For a manual launch you can set the address, key and model in a separate temporary terminal window. You need the exact client model ID from CCR: it may differ from the model name at OpenAI.
Windows: PowerShell 7
$env:ANTHROPIC_BASE_URL = 'http://127.0.0.1:3456'
$env:ANTHROPIC_AUTH_TOKEN = Read-Host 'CCR client key' -MaskInput
$ModelId = Read-Host 'Exact client model ID from CCR'
Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
claude --model "$ModelId"
macOS: Terminal, zsh
export ANTHROPIC_BASE_URL='http://127.0.0.1:3456'
read -rs 'ccr_key?CCR client key: '
printf '\n'
export ANTHROPIC_AUTH_TOKEN="$ccr_key"
unset ccr_key
read 'model_id?Exact client model ID from CCR: '
unset ANTHROPIC_API_KEY
claude --model "$model_id"
CCR accepts the client key in either of two headers. ANTHROPIC_AUTH_TOKEN sends it as Authorization: Bearer, and ANTHROPIC_API_KEY as x-api-key. Set one variable only: that’s why the examples above remove the other. Check the address and the key source with the /status command. How Claude Code passes the key to a gateway is in Anthropic’s documentation.
To switch inside an open Claude Code, type:
/model
In the menu, the s key chooses a model for the current session only, while Enter also saves it as the default model. Typing /model <exact ID> directly works like Enter, meaning it saves the choice too; replace the angle brackets with the real ID. In Claude Code versions 2.1.144 to 2.1.152 the keys worked the other way round, so check the hint at the bottom of the menu. Launching claude --model ... is handy for a one-off experiment, while changing Model in the CCR profile is for later launches through the profile. Anthropic describes the priority of model settings.
The name in the menu is only the requested ID. Which model the proxy actually chose is shown in its logs.
How to connect GPT to the Code tab in Claude Desktop
A working terminal doesn’t prove that the graphical app has connected to the same gateway. According to Anthropic’s documentation, Desktop reads the route from Third-Party Inference, not simply from ANTHROPIC_BASE_URL in the shell or settings.json.
If the CCR profile didn’t apply the route to the app, configure Desktop explicitly. The sequence is the same on Windows and macOS:
- Open Help — Troubleshooting — Enable Developer Mode and wait for the restart.
- Go to Developer — Configure Third-Party Inference.
- Choose Gateway and enter
http://127.0.0.1:3456, if that’s the address CCR runs on. - Choose Static API key and enter the CCR client key. Any authorisation scheme will do: CCR accepts both Bearer and x-api-key.
- Apply the changes and restart the app if it offers to.
- Create a new local Code session in the test folder.
If your organisation sets the configuration, its settings take priority: the form may be read-only. In gateway mode, Anthropic-hosted cloud environments aren’t offered and Remote Control isn’t available. Anthropic lists these limitations.
There’s also a separate problem with the model list. Desktop discovers models through the gateway and filters them as Claude models; an arbitrary GPT may not appear. For this case Anthropic’s documentation provides an explicit inferenceModels list, and CCR, according to its own documentation, passes the profile’s model list to the app if you open Claude App with the button in CCR. Don’t pick a random Claude alias in the hope that it’ll become GPT on its own: the mapping has to be set by the gateway. The model list mechanism is described here.
How to check that Claude Code is talking to GPT
Asking the model to name itself is pointless: such an answer doesn’t confirm the routing. The name in the app header may also be an alias.
In CCR open Settings, the Logs & Observability section, and turn on the Request logs toggle. Then send a non-secret request from a new session:
Reply only with ROUTE-TEST-2710. Don’t use tools and don’t change files.
Find it in the log by time and text. You need two fields: resolved provider and resolved model, that is, where CCR actually sent the request and which model it chose there. For the API route this should be your OpenAI provider; for the import, Codex API. And the request itself has to complete successfully. What CCR logs store.
After the text request, ask it to read the prepared test file and return its line. This checks not just the model’s reply but the tool call loop. After that you can separately allow a small edit to the test file.
An extra check: stop the CCR server and send a new unique request. You should get a connection error. If you get a normal reply instead, requests are going by some other route, and you need to find out which. Then switch the gateway back on. This test shows that Claude depends on CCR, but which model stands behind the gateway is still visible only in the log.
Repeat the check separately in the CLI and in Desktop. Both results matter.
When you move on to a working project, the 40 rules for an engineering approach to vibe coding come in handy: they help organise work with the agent once the question of connecting the model is settled.
CCR errors: 401, 429, Model not found and tools
The translation between API formats may turn out to be incomplete. An ordinary reply doesn’t mean that tools, images, streaming, reasoning, context compression and auxiliary models work correctly. These are areas to check, not a list of confirmed breakages in each version.
| Symptom | Where to start |
|---|---|
| The request isn’t in CCR | Check the logs, the profile, the port and that Claude is a new process |
| Error 401 | Find which link fails: Claude’s key to CCR, or CCR’s authorisation with the provider |
| Model not found | Compare the client alias, the real ID and the account’s access |
| Error 429 | Check the quota and request rate; don’t run endless retries |
| Text works, reading a file doesn’t | Check tool call compatibility |
| The CLI works, Desktop doesn’t | Check Third-Party Inference and the model list |
Logs may contain the text of requests and tool results. Start without secrets; the local gateway sends the content of requests to the cloud model anyway.
How to switch GPT off and get Claude back: rolling back CCR
First finish the test operations. Switch off the CCR profile and close the sessions launched through it. If you only used a temporary PowerShell or Terminal window, close it and open a new one: the variables set inside it weren’t written to a persistent profile.
If you changed Third-Party Inference, go back to the same form and restore the previous configuration. Simply switching off Developer Mode doesn’t reset the route. If you extended the CCR profile’s scope to all Claude launches or saved a model through /model, compare ~/.claude/settings.json with the copy and revert only your own changes, without wiping later edits.
Now launch Claude the usual way and send a new test while CCR is still running: this request shouldn’t appear in the CCR log. Then stop CCR and send another one. If Claude replies with a connection error to the gateway, it’s still bound to it.
When you end the experiment, disable and delete the imported authorisation through CCR itself. codex logout doesn’t guarantee that a token already copied into a third-party app stops working. Don’t delete the whole .codex and .claude folders just to roll back one connection.
Another option: talk to GPT through Codex CLI
If you simply want to work on a project with GPT, a local proxy isn’t necessary. Install Codex and do the official sign-in, as described above. Then open a terminal in the folder of the project you need and run:
codex
This is a separate Codex session. You can switch between terminals by hand; Claude’s model settings don’t change because of it. The supported ChatGPT sign-in stays inside Codex, without copying the authorisation into CCR. The available models and quotas depend on the account. The official getting-started guide for Codex CLI.
If you want OpenAI’s own graphical interface, we wrote about combining the chat and the development environment in our breakdown of ChatGPT and Codex merging into one app. That’s a different route, without keeping the Claude harness.
A single request without an interactive conversation
For a one-off assignment there’s codex exec. An example for a small Git repository with a README.md:
Windows, PowerShell 7:
codex login status
codex exec --sandbox read-only "Read only README.md and briefly explain what the project is for. Don't change files and don't run project commands."
macOS, Terminal:
codex login status
codex exec --sandbox read-only 'Read only README.md and briefly explain what the project is for. Do not change files and do not run project commands.'
Replace the file name with one that actually exists. If the task is outside a Git repository, Codex may require an explicit --skip-git-repo-check; add it only for a folder you’ve chosen deliberately. read-only restricts writing, but it doesn’t mean the text that’s read stays on your computer: the chosen model processes it. This kind of assignment doesn’t require switching on full access mode. The codex exec documentation.
Calling Codex CLI from inside a Claude Code session
You can ask Claude to run the same codex exec with its terminal tool. For example:
Call the installed Codex CLI through codex exec in read-only mode. Give it the task: read only README.md and give a second opinion on the project description. Don’t add other files to the task and don’t change the project. Show Codex’s answer separately from your own comment.
Terminal Claude Code also lets you run a command directly with the ! prefix:
!codex exec --sandbox read-only "Read only README.md and explain what the project is for. Don't change anything."
This is a command for the input field of terminal Claude Code, not ordinary PowerShell. Anthropic documents the ! mode. In the Code tab in Desktop, don’t count on this kind of input: ask Claude in plain text to run the command, or install the plugin covered below.
The launching process must have access to codex and its authorisation. If a standalone terminal can see the CLI but Claude can’t, check PATH and the working folder. An assignment doesn’t automatically carry Claude’s whole conversation over to Codex: the context has to be passed explicitly. If the answer comes back to Claude as a tool result, it also ends up in Claude’s context. Two parallel agents shouldn’t edit the same files at the same time; for a second opinion, a read-only run is more convenient.
How to pick only the data an assignment needs is explained in the article on Context Engineering and managing an agent’s context.
The official plugin: Codex assignments from Claude Code
OpenAI has an official Codex plugin for Claude Code. It solves a related problem: Claude stays the main agent and hands separate work to Codex. For example, you can get a second opinion on code without importing your authorisation into a general-purpose proxy.
The commands are typed inside Claude Code:
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setup
For a trial review of a small repository:
/codex:review --background
/codex:status
/codex:result
This doesn’t switch the whole harness to GPT. But if the goal is to use what both models can do in one workflow, this option is worth trying before the experiment with a full swap.
Instead of CCR: another local proxy
LiteLLM also documents connecting Claude Code: the client sends Anthropic Messages, and the gateway translates the requests into the configured provider’s format. The principle is the same: the gateway address, its client key and the exact model alias.
This is an option for those who already have LiteLLM installed or need its management features. CCR’s launch commands, ports and configuration format can’t be carried over to it. Setting up Desktop still differs from the terminal, and Anthropic’s limitation on supporting other models remains. Having a proxy doesn’t give you the right to use a ChatGPT subscription as an API.
What to choose for your scenario
For the swap itself, start with one provider, one model and a limited CCR profile. Move on to a working project after two checks: the request really reached the right provider, and the tools did what you allowed them to. That’s exactly what separates a configured integration from a nice model name in the interface.
For a separate GPT answer, Codex CLI is enough; for a second opinion straight from Claude, codex exec or the official plugin will do. This lets you first check whether another model is useful for your task, and then decide whether you need to swap the whole agent loop through CCR.
FAQ on GPT in Claude Code
Can I choose GPT with the /model command without a proxy?
The command itself changes the requested model ID. In the method described here, you first need a configured CCR with access to OpenAI, and then you choose a model from its list. Typing the GPT name alone isn’t enough to set up the address, authorisation and API translation.
Can I use a ChatGPT subscription instead of an OpenAI API key?
Codex supports the official sign-in with ChatGPT. CCR can import that sign-in, but OpenAI’s terms allow you to use the subscription only in the connected app, not to hand it out to other tools through a proxy. Calling Codex CLI separately or using the official plugin doesn’t require importing your authorisation into CCR.
Why does GPT work in the terminal but not in Claude Desktop?
These interfaces have different sources of settings. For Desktop, check Third-Party Inference, starting a new local session and the gateway’s model list. Success in the CLI doesn’t confirm the setup of the graphical Code tab.
Does the Codex plugin replace Claude with GPT?
The plugin hands separate assignments to Codex, while Claude stays the lead agent. If what you need is specifically GPT inside the agent loop of the Claude Code harness, the main method in this article is the local CCR proxy.





