OpenAI’s AI coding agent tool, Codex CLI, recently opened up support for any third-party model, no longer limited to OpenAI’s own models. Developers can connect Codex to any service compatible with the OpenAI Responses API—such as DeepSeek, Claude, Gemini, or local Ollama models—simply through the config.toml configuration file, greatly expanding developers’ options.

The news was shared by developer Tibo on X, who wrote in a post: “Reminder that the Codex App, CLI, and SDK can use any open-source model, not just OpenAI models.” This is great news for developers who are accustomed to being locked into a single ecosystem.
Reminder that you can use the Codex App, CLI and SDK with any open source model, not just with OpenAI models.https://t.co/spPifB4ck3
— Tibo (@thsottiaux) June 17, 2026
What is Codex CLI?
Codex CLI is a lightweight coding agent tool launched by OpenAI. It runs in the local terminal and supports standalone use or integration with IDEs such as VS Code, Cursor, and Windsurf. Unlike Claude Code, which requires npm installation, Codex CLI is distributed as a single binary, supporting macOS, Windows, and Linux, making the installation process much simpler. Currently, the open-source project on GitHub has accumulated over 91,600 stars and 13,500 forks. The latest version is 0.140.0 (released on June 15, 2026), with a total of 845 releases. It is developed using Rust (accounting for 96.2%).

Besides the CLI version, OpenAI also offers Codex Desktop, a desktop application, and Codex Web, a cloud version (chatgpt.com/codex), allowing developers to choose how to use it based on their needs.
Third-party Model Support: config.toml Settings
According to OpenAIDeveloper DocumentationCodex model settings are managed through a config.toml file, supporting multi-level overrides: user-level (~/.codex/config.toml), project-level (.codex/config.toml), and command-line arguments. Developers can register multiple Providers in the config file and switch between them at any time.
Each custom provider requires three core fields: base_url (the API endpoint address), env_key (the environment variable name corresponding to the API Key), and name (the display name). Since Codex removed Chat Completions API support starting February 2026, all third-party models must be compatible with the OpenAI Responses API, which requires special attention during configuration.
Below is a configuration example for connecting to DeepSeek:
[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
wire_api = "responses"
After completing the setup, you can specify the use of a third-party model via the command line:codex --provider deepseek --model deepseek-coder "寫一個快速排序"Developers can also register multiple Providers in the same configuration file and dynamically switch between them based on task requirements.
If you don’t know how to set it up, you can actually just ask Codex to do it for you. Just follow the steps in this X post – just use your voice and you’re all set:
Codex 自定义模型已经能用了。
最简单的玩法不是自己手改配置,而是让 Codex 自己帮你配置 Codex Desktop。
直接对 Codex 说:
请读取 ~/.codex/config.toml,帮我添加自定义模型配置。
不要覆盖已有配置,不要把 API Key 明文写进文件。
配置完检查 TOML 语法,并告诉我是否需要重启 Codex… pic.twitter.com/2gneZjPZvI— Wei (@wei_wang) June 18, 2026
Third-party model ecosystem support
Since Codex adopts the open Responses API protocol, any model service compatible with this protocol can theoretically be integrated, including:
For third-party models, DeepSeek (deepseek-chat / deepseek-coder), Kimi (Moonshot), Zhipu GLM, Qwen, and others can all be connected using the same configuration method. For local models, Ollama and LM Studio can be accessed through the http://localhost:11434/v1 endpoint, allowing developers to use Codex in offline environments without requiring an internet connection for coding work. For aggregated API gateways, services like OfoxAI provide access to multiple models including GPT, Claude, Gemini, and DeepSeek with a single API key, simplifying key management. For enterprise solutions, Azure OpenAI and Google Vertex AI (Gemini 2.5 Pro) also have corresponding configuration recipes.
OpenAI’s Openness Strategy
Codex’s support for third-party models stands in stark contrast to OpenAI’s historically closed ecosystem strategy. This transforms Codex from an “OpenAI model-exclusive client” into a “model-neutral coding agent platform,” allowing developers to freely choose underlying models based on cost, performance, or privacy requirements, no longer limited to a single vendor.
In fact, OpenAI Official documentIt also clearly states: “You can point Codex to any model and provider that supports the Chat Completions or Responses API to meet your specific use case.” This open strategy broadens Codex’s application scope and gives it a unique positioning advantage over competitors like Claude Code and GitHub Copilot.
Third-Party Model Support for Claude Code: Community Self-Help
Unlike OpenAI’s generous openness, Anthropic takes a much more conservative approach to Claude Code using third-party models. Claude Code natively only supports Anthropic’s own models (Opus, Sonnet, Haiku), and the official documentation does not provide formal support for integrating third-party models like DeepSeek or Gemini.
However, the developer community did not back down. Since Claude Code’s API endpoint can be redirected through the environment variable ANTHROPIC_BASE_URL, community developers have been forwarding requests to third-party services compatible with the Anthropic API format (such as OpenRouter, DeepSeek, etc.) to bypass the restrictions and use other models. Recently, Claude Code Desktop version 1.6259.1 has reportedly begun implementing a model whitelist mechanism, further blocking third-party model IDs, indicating that Anthropic is gradually tightening this pathway.
CC Switch: Centralized Management for All AI Coding CLI Tools
In this climate of “if the official won’t provide it, the community will build it themselves,” an open-source desktop app called CC Switch has rapidly gained traction. Built on Tauri 2, this tool provides a unified graphical interface for managing provider settings across seven AI coding CLI tools—including Claude Code, Codex, Gemini CLI, OpenCode, OpenClaw, and Hermes Agent. It supports macOS, Windows, and Linux, and has accumulated over 103,000 stars and 9 million downloads on GitHub.
Core features of CC Switch include: over 50 built-in Provider presets, one-click Provider switching, Local Proxy with hot-swapping and automatic failover (automatically switches to a backup Provider when the primary Provider fails), unified management of MCP servers and Skills, a usage dashboard for real-time tracking of Token consumption and costs, and cross-device cloud synchronization. Developers no longer need to manually edit JSON, TOML, or .env files—all operations are completed within a single desktop application. CC Switch uses a Rust backend with a React frontend architecture, with all API Keys and settings securely stored in a local SQLite database.

This also creates a clear contrast in brand positioning: OpenAI chose an open strategy, making Codex a model-neutral coding agent platform; Anthropic, on the other hand, leans toward a closed ecosystem, binding Claude Code to its own models. The emergence of community tools like CC Switch perfectly fills the gap for Claude Code users who want the freedom to choose different models. (Editor’s note: I’ve always thought Claude is a great model, but I won’t comment on its parent company, Anthropic…)
Summary
OpenAI Codex CLI’s support for third-party models marks a significant turning point in the AI coding tool market. This means developers are no longer locked into OpenAI’s ecosystem, and can freely choose DeepSeek’s cost-effective solution, Ollama’s local offline solution, or other frontier models like Claude and Gemini. For a tool developed and open-sourced by OpenAI, this “embrace openness” strategy has won applause from the developer community, and opens up more possibilities for the future development of AI coding agents. The existence of community tools like CC Switch further enables developers to seamlessly switch between different coding agents, forming a complete open ecosystem.
Source: KOCPC Chinese