Integration guide
Codex
Codex is OpenAI's coding agent. You can use it inside the ChatGPT desktop app or from the terminal with Codex CLI. Both local clients use the same user-level ~/.codex/config.toml, so you only need to configure CrossModel once.
CrossModel supports the Responses API used by Codex directly. You do not need to install or run a separate router or proxy.
This configuration changes the model provider for local Codex work in the ChatGPT desktop app and Codex CLI. It does not change regular ChatGPT chats, Work, the ChatGPT web app, or Codex cloud.
Quickstart
1. Choose a client
For the desktop experience, install the ChatGPT desktop app, sign in, and choose Codex.
If you also want the terminal client, install Codex CLI.
macOS / Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | shWindows:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"Or install it with npm:
npm install -g @openai/codexAlready using either client? Skip the installation and continue with the same configuration below.
2. Create an API key
Sign in to the Console and create a key that starts with cm- on the API Keys page. The key is shown only once, so copy it somewhere safe.
3. Add CrossModel as the shared provider
Edit ~/.codex/config.toml and add the following configuration. Create the file if it does not exist.
model_provider = "crossmodel"
model = "deepseek/deepseek-v4-pro"
[model_providers.crossmodel]
name = "CrossModel"
base_url = "https://api.crossmodel.ai/v1"
env_key = "CROSSMODEL_API_KEY"
wire_api = "responses"This is a user-level setting shared by the ChatGPT desktop app's Codex workspace and Codex CLI. The provider block follows OpenAI's custom model provider configuration: base_url points Codex at CrossModel, env_key names the environment variable that contains your key, and wire_api selects the Responses API.
4. Set the API key environment variable
On macOS or Linux, add the variable to your shell profile (~/.zshrc or ~/.bashrc):
export CROSSMODEL_API_KEY="cm-YOUR_KEY"Open a new terminal, or reload the profile you edited:
source ~/.zshrcOn Windows PowerShell, set it for the current session:
$env:CROSSMODEL_API_KEY = "cm-YOUR_KEY"To save it as a user environment variable for future PowerShell sessions and the desktop app:
[Environment]::SetEnvironmentVariable("CROSSMODEL_API_KEY", "cm-YOUR_KEY", "User")The ChatGPT desktop app must be able to read CROSSMODEL_API_KEY, not just your terminal. After setting or changing the variable, fully quit ChatGPT and reopen it. If Codex CLI works but the desktop app reports an authentication error, the app process has not inherited the variable; set it in your operating system's user environment, then sign out and back in if needed.
5. Start Codex
In the ChatGPT desktop app, choose Codex, open your project, and start a new task. After changing config.toml, fully quit and reopen ChatGPT before testing.
For Codex CLI, run it from your project directory:
cd /path/to/your/project
codexHow it works
Codex sends Responses API requests directly to https://api.crossmodel.ai/v1. CrossModel authenticates the cm- key, routes each request to the selected upstream model, converts protocols when necessary, and bills usage to your CrossModel wallet. There is no local routing service to install or keep running.
Choosing models
Change the default model by editing the model field in ~/.codex/config.toml. This guide deliberately uses deepseek/deepseek-v4-pro to show that Codex can run with a non-OpenAI model through CrossModel. Model IDs use the vendor/short_name format; browse the current IDs and capabilities in the model catalog.
For a one-off CLI session, override the configured model with -m:
codex -m openai/gpt-5.6-terraChoose a model with tool-calling support for the full agent experience. The built-in model picker may not discover every model in the CrossModel catalog automatically; setting model explicitly still works.
You can also point model at a model alias defined on your API key. Keep config.toml fixed on a stable name such as cross-model-pro, then switch the real model from the dashboard without editing either client.
Troubleshooting
| Symptom | What to check |
|---|---|
| Auth failure in both clients | Confirm CROSSMODEL_API_KEY contains an active cm- key and is available in the current environment. |
| CLI works but the desktop app fails auth | Fully quit and reopen ChatGPT. If it still fails, expose CROSSMODEL_API_KEY to GUI applications through your operating system's user environment. |
| "Model not found" | Verify that model exactly matches an ID in the model catalog or the /v1/models response. |
| Requests bypass CrossModel | Confirm model_provider = "crossmodel", the provider block is named [model_providers.crossmodel], and base_url ends with /v1. |
| The old model is still active | Start a new task after editing config.toml; for the desktop app, fully quit and reopen ChatGPT. |
| The model replies but cannot edit files or run tools | Choose a model whose catalog entry includes tool-calling support. |
| Insufficient balance | Top up in the Console. |