Codex CLI
Codex CLI lets you add custom model providers in its config file. OpenPalmLab provides an OpenAI Responses-compatible endpoint (/v1/responses), so the setup below is all you need.
Before you start
Section titled “Before you start”- Codex CLI is installed.
- Your token’s group includes models that support the Responses endpoint type (see the pricing page).
1. Set the API key environment variable
Section titled “1. Set the API key environment variable”macOS / Linux (add it to ~/.bashrc or ~/.zshrc so it persists):
export OPENPALMLAB_API_KEY=sk-xxxxWindows PowerShell (persists for the current user):
[Environment]::SetEnvironmentVariable("OPENPALMLAB_API_KEY", "sk-xxxx", "User")Open a new terminal afterwards so the variable is picked up.
2. Edit config.toml
Section titled “2. Edit config.toml”Edit ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml):
model_provider = "openpalmlab"model = "YOUR_MODEL"
[model_providers.openpalmlab]name = "OpenPalmLab"base_url = "https://api.openpalmlab.com/v1"env_key = "OPENPALMLAB_API_KEY"wire_api = "responses"base_urlmust include/v1.env_keyis the name of the environment variable, not the token itself, so the token never appears in the config file.modelis a model name from the pricing page.
3. Check it works
Section titled “3. Check it works”codex "list the files in this directory"If you get a normal reply and see the request on the console’s Logs page, you are set up.
Common problems
Section titled “Common problems”| Symptom | Fix |
|---|---|
| Codex still asks you to log in | Make sure model_provider is at the top level of the file (not under a [...] table) and matches the name in [model_providers.xxx]. |
401 |
The environment variable is not set. Run echo $OPENPALMLAB_API_KEY in the same terminal to check. |
404 |
base_url is missing /v1. |
| Model not available | Use a model the pricing page lists as supporting the Responses endpoint. |
You can also manage Codex provider settings in a GUI with CC Switch.