Using OpenAI Codex CLI
Run Codex CLI with Onysoft models
Codex can use Onysoft as a custom model provider. Codex uses the Responses API endpoint. The configuration below works with Codex's default tool options; no extra lines turning off web_search or multi_agent are needed.
Installation
npm i -g @openai/codex
Configuration File
The configuration file is ~/.codex/config.toml on macOS and Linux and %USERPROFILE%\.codex\config.toml on Windows. Put the following in it (instead of the model shown you can use another catalog id such as anthropic/claude-sonnet-5.5 or openai/gpt-5.5):
model_provider = "onysoft"
model = "openai/gpt-5.3-codex"
[model_providers.onysoft]
name = "Onysoft"
base_url = "https://api.onysoft.com/v1"
env_key = "ONYSOFT_API_KEY"
wire_api = "responses"
# recommended: keep the key out of commands Codex runs and out of ~/.codex/shell_snapshots files
[shell_environment_policy]
exclude = ["ONYSOFT_API_KEY"]
Setting the Key
Codex reads the key from the ONYSOFT_API_KEY environment variable. Enter the key hidden (it is not written to the command history):
$secret = Read-Host "Paste your Onysoft API key" -AsSecureString
$env:ONYSOFT_API_KEY = [System.Net.NetworkCredential]::new("", $secret).Password
Remove-Variable secret
codex
read -rs "ONYSOFT_API_KEY?Onysoft API key: "; echo
# if you use bash, instead: read -rsp "Onysoft API key: " ONYSOFT_API_KEY; echo
export ONYSOFT_API_KEY
codex
Models
Models tried with this configuration on Codex 0.166: openai/gpt-5.3-codex, openai/gpt-5.5, anthropic/claude-sonnet-5.5 and the free deepseek/deepseek-v4.1-flash:tr (on personal keys free models are available to verified accounts). You can use other chat models as well; write the id exactly as in the catalog.
Notes
- The previously recommended
web_search = "disabled"and[features] multi_agent = falselines are no longer needed; they are harmless if they are still in your file. - Web search and other hosted tools are not available on this endpoint: the request continues without them and the response carries an
X-Onysoft-Warning: ignored_tools=…header. - The cloud/web version of Codex cannot use a custom provider; this configuration is for the local Codex CLI. The VS Code extension uses the same configuration file (the extension itself was not tested end to end).
- Codex does not send a maximum output limit, so the balance pre-check uses the model's maximum output tokens. For models with a large output cap this threshold can be high: if your balance is below it, requests get 402 even though the balance is not zero (the message states the required and the available amount). You are charged for actual usage.
- The per-minute limit is per API key while the balance is shared across your account: use separate keys for Codex, Cursor and Claude Code.