Connect Codex to the gateway
Start a DeepSeek Flash session, read a project file, then switch to another gateway model. Follow the numbered steps below with your delivered Multi-Model Gateway key and address.
Configure once · switch models inside the Agent
Includes the TOML connection template and the required eight-model catalog. Save both. Desktop includes separate macOS and Windows templates: choose one.
Individual files remain available in the numbered steps below.
Before you begin
- Have your activated gateway key and its confirmed endpoint ready.
- Choose a local project with a README.md for the first conversation.
- Run shell commands in Terminal on macOS / Linux, or inside WSL on Windows. Paste prompts and slash commands inside the Agent.
Use the gateway credentials and model IDs in this guide. A direct DeepSeek Platform key, endpoint or setup script configures a different service.
1. Install and check your version
Install the Agent using its official guide below. Terminal examples use macOS / Linux or Windows WSL. If already installed, check your version and continue.
Run in Terminal ·Terminal
npm install -g @openai/codex
codex --version2. Save your key
Add this export to your shell startup file: ~/.zshrc for Zsh, or ~/.bashrc for Bash. Replace the placeholder locally, save, then open a new terminal.
Use that terminal to launch the Agent. On Windows, follow these terminal steps inside WSL.
Save in your shell startup file ·Shell startup file · Bash / Zsh
export MULTI_MODEL_API_KEY="REPLACE_WITH_YOUR_DELIVERED_GATEWAY_KEY"3. Declare all eight models
Codex uses two files: the TOML configuration selects a provider and a default model; multi-model-catalog.json declares the models shown in the picker. Setting model = "deepseek-flash" alone does not declare the other seven models.
The setup ZIP above includes both files. If downloading individually, save both the catalog here and the TOML in the next step. The eight models and their effort choices come from the catalog, not from the single startup model setting.
Save the catalog below as multi-model-catalog.json inside your .codex folder. Download the ready-to-use file, or open the complete JSON below, copy it and save it yourself. Both contain the same eight declarations; use one method.
Each models entry uses slug as the exact gateway model ID and display_name as its picker label. Keep the other fields supplied in the catalog. The catalog also declares each model's available reasoning controls. A default is a starting choice, not a lock. Your gateway key determines access.
Use ~/.codex, or your CODEX_HOME folder if you set one. Terminal instructions also apply inside Windows WSL.
| Model / display_name | Model ID / slug |
|---|---|
| DeepSeek Flash | deepseek-flash |
| GLM-5.3-Flash | glm-5.3-flash |
| MiMo V2.6 Flash | mimo-flash |
| MiMo V2.6 Pro | mimo-pro |
| GLM-5.3 | glm-5.3 |
| Kimi-K3 | kimi-k3 |
| Qwen3.8 Max | qwen3.8-max |
| MiniMax M3 | minimax-m3 |
View and copy all eight model declarations (JSON)
multi-model-catalog.json · complete model declarations. Save this JSON in its own file; keep the TOML configuration in step 4 separate.
{
"models": [
{
"slug": "deepseek-flash",
"display_name": "DeepSeek Flash",
"description": "Multi-Model Gateway",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "none",
"description": "Off"
},
{
"effort": "low",
"description": "Low"
},
{
"effort": "high",
"description": "High"
},
{
"effort": "max",
"description": "Max"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 0,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "glm-5.3-flash",
"display_name": "GLM-5.3-Flash",
"description": "Multi-Model Gateway",
"default_reasoning_level": "max",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Low"
},
{
"effort": "high",
"description": "High"
},
{
"effort": "max",
"description": "Max"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "mimo-flash",
"display_name": "MiMo V2.6 Flash",
"description": "Multi-Model Gateway",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "none",
"description": "Off"
},
{
"effort": "high",
"description": "On (thinking enabled; not a separate High intensity)"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "mimo-pro",
"display_name": "MiMo V2.6 Pro",
"description": "Multi-Model Gateway",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "none",
"description": "Off"
},
{
"effort": "high",
"description": "On (thinking enabled; not a separate High intensity)"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 3,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "glm-5.3",
"display_name": "GLM-5.3",
"description": "Multi-Model Gateway",
"default_reasoning_level": "max",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Low"
},
{
"effort": "high",
"description": "High"
},
{
"effort": "max",
"description": "Max"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 4,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text"
]
},
{
"slug": "kimi-k3",
"display_name": "Kimi-K3",
"description": "Multi-Model Gateway",
"default_reasoning_level": "max",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Low"
},
{
"effort": "high",
"description": "High"
},
{
"effort": "max",
"description": "Max"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 5,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "qwen3.8-max",
"display_name": "Qwen3.8 Max",
"description": "Multi-Model Gateway",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "none",
"description": "Off"
},
{
"effort": "low",
"description": "Low"
},
{
"effort": "medium",
"description": "Medium"
},
{
"effort": "xhigh",
"description": "XHigh"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 6,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
},
{
"slug": "minimax-m3",
"display_name": "MiniMax M3",
"description": "Multi-Model Gateway",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "none",
"description": "Off"
},
{
"effort": "high",
"description": "On (thinking enabled; not a separate High intensity)"
}
],
"shell_type": "unified_exec",
"visibility": "list",
"supported_in_api": true,
"priority": 7,
"base_instructions": "You are a coding assistant. Follow the user's instructions, inspect relevant files before editing, and verify your work. Respect the configured tool permissions and approvals.",
"supports_reasoning_summaries": false,
"supports_reasoning_summary_parameter": false,
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": null,
"truncation_policy": {
"mode": "bytes",
"limit": 10000
},
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
]
}
]
}Run in Terminal ·Terminal · open the catalog file for manual setup
gateway_codex_dir="${CODEX_HOME:-$HOME/.codex}"
mkdir -p "$gateway_codex_dir"
nano "$gateway_codex_dir/multi-model-catalog.json"Skip the editor commands if you downloaded the file. For manual setup, paste the complete JSON into the editor and save; in nano, press Ctrl+O, Enter, then Ctrl+X.
In the next step, model_catalog_json must point to this saved file using an absolute path. To start on MiniMax M3 instead, change the top-level model setting to "minimax-m3"; keep the provider and catalog unchanged.
4. Select the provider and default model
Save the TOML below as multi_model_gateway.config.toml inside CODEX_HOME, or ~/.codex when CODEX_HOME is unset. Codex CLI 0.134.0 or later loads this separate file when you select --profile multi_model_gateway. Update older versions before using these profile files.
Run the editor command below, paste the TOML into the file, then save with Ctrl+O, Enter and exit with Ctrl+X. You can also open the same path in your usual text editor.
model = "deepseek-flash" selects the default model by its exact gateway ID. model_provider selects the connection. model_catalog_json points to the eight model declarations saved in step 3: replace the placeholder with that file's absolute path.
Terminal · create the directory and open the gateway profile
gateway_codex_dir="${CODEX_HOME:-$HOME/.codex}"
mkdir -p "$gateway_codex_dir"
nano "$gateway_codex_dir/multi_model_gateway.config.toml"Configuration ·~/.codex/multi_model_gateway.config.toml · dedicated profile file
Save beside your main Codex config.toml. Replace the catalog path with the absolute path to the JSON from step 3; keep the key in MULTI_MODEL_API_KEY.
model_provider = "multi_model_gateway_cli"
model = "deepseek-flash"
model_catalog_json = "/ABSOLUTE/PATH/TO/multi-model-catalog.json"
web_search = "live"
[model_providers.multi_model_gateway_cli]
name = "Multi-Model Gateway"
base_url = "https://multi-api.deepseekv4pro.com/v1"
env_key = "MULTI_MODEL_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = falseKeep the first four settings above any [table]. web_search = "live" lets Codex request current search results when your gateway access includes search.
The CLI uses provider ID multi_model_gateway_cli so it can coexist with the Desktop provider. Your existing feature, approval and sandbox settings still apply.
5. Start Codex
Open a new terminal that has your key, enter your project folder, then start the gateway profile. Inside Codex, /status checks the provider and /model opens the full catalog.
If the catalog is missing, check the absolute file path in your active configuration. Model-list loading is separate from a successful inference request.
Run in Terminal ·Terminal · replace the example project path
cd /path/to/your-project
codex --profile multi_model_gatewayEnter in the Agent ·Inside Codex · confirm the provider
/status
6. Choose reasoning effort
Start on DeepSeek Flash. Choose Low, send a short file-reading task, then choose High and repeat. Check the current setting after each change. A longer answer by itself does not prove the effort changed.
Effort means how much reasoning to request. Kimi K3, GLM 5.3 and GLM 5.3 Flash offer Low / High / Max with thinking always enabled. Choose Low for shorter reasoning; there is no Off option. Their model default is Max, but a client setting can override it. DeepSeek and Qwen have their own intensity levels listed below.
MiMo has an On / Off switch; High is the client's label for On. MiniMax M3 supports Off / Auto / On through thinking.type (disabled / adaptive / enabled). Its effort-only menus expose Off and High (On); Auto needs a native thinking control. These modes are not separate Low / High / Max intensities. Follow this Agent's default and switching instructions below; a supported control does not set a session's starting value.
Use /model, select DeepSeek Flash, then choose the reasoning level. Open /status to inspect the current session. Repeat /model to change it without editing JSON. The catalog declares the available choices; it does not lock the session to a default.
- DeepSeek Flash
- Off / Low / High / Max
- Starting setting: high
- Start with Low; choose High or Max for more reasoning, or Off to disable thinking. Medium and XHigh requests map to High; Ultra maps to Max.
- GLM-5.3-Flash
- Low / High / Max
- Starting setting: max
- Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort.
- MiMo V2.6 Flash
- Off / On
- Starting setting: On (High)
- Choose On to enable thinking or Off to disable it. In clients that label On as High, choose High. There are no separate Low, Medium or High intensities.
- MiMo V2.6 Pro
- Off / On
- Starting setting: On (High)
- Choose On to enable thinking or Off to disable it. In clients that label On as High, choose High. There are no separate Low, Medium or High intensities.
- GLM-5.3
- Low / High / Max
- Starting setting: max
- Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort.
- Kimi-K3
- Low / High / Max
- Starting setting: max
- Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort.
- Qwen3.8 Max
- Off / Low / Medium / XHigh
- Starting setting: xhigh
- Start with Low; choose Medium or XHigh for more reasoning, or Off to disable thinking. High, Max and Ultra requests all map to XHigh.
- MiniMax M3
- Off / On
- Starting setting: On (High)
- High means On. Auto needs the native thinking.type=adaptive control; this setup's effort selector does not expose Auto. Check the current selection before sending.
| Model | What can I change? | Starting setting | What should I do? |
|---|---|---|---|
| DeepSeek Flash | Off / Low / High / Max | high | Start with Low; choose High or Max for more reasoning, or Off to disable thinking. Medium and XHigh requests map to High; Ultra maps to Max. |
| GLM-5.3-Flash | Low / High / Max | max | Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort. |
| MiMo V2.6 Flash | Off / On | On (High) | Choose On to enable thinking or Off to disable it. In clients that label On as High, choose High. There are no separate Low, Medium or High intensities. |
| MiMo V2.6 Pro | Off / On | On (High) | Choose On to enable thinking or Off to disable it. In clients that label On as High, choose High. There are no separate Low, Medium or High intensities. |
| GLM-5.3 | Low / High / Max | max | Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort. |
| Kimi-K3 | Low / High / Max | max | Choose Low for shorter reasoning, High for more reasoning, or Max for the largest budget. Thinking is always enabled; there is no Off option. The model default is Max unless the client sends a different effort. |
| Qwen3.8 Max | Off / Low / Medium / XHigh | xhigh | Start with Low; choose Medium or XHigh for more reasoning, or Off to disable thinking. High, Max and Ultra requests all map to XHigh. |
| MiniMax M3 | Off / On | On (High) | High means On. Auto needs the native thinking.type=adaptive control; this setup's effort selector does not expose Auto. Check the current selection before sending. |
The catalog supplies a separate default and supported list for every model. Remove an old model_reasoning_effort = "low" if you want these catalog defaults. A command-line -c override or saved task selection can still take precedence.
7. Choose a model and start working
Type /model in Codex and choose a model from the gateway catalog. Keep the gateway provider selected.
Open a project with a README.md and send the file-reading prompt below. Approve access to the file if prompted. You can switch models later without changing the key or gateway address.
You can also ask a question or search for current documentation. Send each example as a separate message.
Enter in the Agent ·Ask a question
What is 6 × 7?Enter in the Agent ·Read a project file
Use the file-reading tool to read README.md in the selected project and summarize its purpose in one sentence. Do not modify any files.Enter in the Agent ·Find documentation
Use web_search to find the official Claude Desktop gateway documentation. Summarize the setup requirements and include source links.Switch models in Codex
Use one command or picker entry at a time. An arrow means choose the entry in the picker; it is not part of a command. Your key must have access to the model you choose.
- DeepSeek Flash
/model → deepseek-flash - GLM-5.3-Flash
/model → glm-5.3-flash - MiMo V2.6 Flash
/model → mimo-flash - MiMo V2.6 Pro
/model → mimo-pro - GLM-5.3
/model → glm-5.3 - Kimi-K3
/model → kimi-k3 - Qwen3.8 Max
/model → qwen3.8-max - MiniMax M3
/model → minimax-m3

Connection reference
Keep these values consistent with the configuration above.
| Parameter | Value and purpose |
|---|---|
| Base URL | https://multi-api.deepseekv4pro.com/v1Keep the /v1 suffix in the provider base URL. |
| API protocol | OpenAI Responses |
| API key | Use your delivered gateway key in the location shown in the setup steps. Replace credential placeholders locally. |
| Starting model | deepseek-flash |
| model_catalog_json | The absolute path to your downloaded catalog. Keep wire_api = "responses" and WebSockets disabled in this profile. |
Optional: check the API connection
Agent protocol: OpenAI Responses. This Bash command uses the same API protocol with DeepSeek Flash. First export MULTI_MODEL_API_KEY in your terminal even if you saved the key in a settings file. The response should contain a short reply from DeepSeek Flash.
curl --fail-with-body "https://multi-api.deepseekv4pro.com/v1/responses" \
-H "Authorization: Bearer $MULTI_MODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-flash","input":"Reply with a short hello.","max_output_tokens":256}'Troubleshooting
- Models are missing
- Check the active config path, restart the Agent and look for project overrides. In Codex, check model_catalog_json; in OpenClaw, check model allowlists. Older Claude Code versions can use /model with an exact ID.
- Chat works but search fails
- Confirm that search is enabled for your gateway access. Send the provider the client version, selected model and error with credentials removed.
- 401 / 404
- 401: confirm the key is available to the running process. 404: check the model ID and base URL. Claude Code uses the root host; the other Agents here use /v1.
- 429 / unavailable endpoint
- Read the error for quota or provider capacity. Changing models does not refill points. Before activation, use only the confirmed endpoint supplied with your key.