Configure Codex
This page explains how to connect Codex CLI, Codex Desktop, or the Codex IDE extension to the LLMAPI Responses API. Use an API key whose group supports Responses.
Before you configure Codex
- Create or select a Regular API key on the website's API Key page. It will normally be bound to an OpenAI group.
- Call
GET /v1/modelswith that key and confirm that the model you intend to use is available. - Fully quit the Codex CLI, Codex Desktop, or IDE extension you use so that an active client does not overwrite the files.
- If Codex is already configured, back up the files and merge the required fields instead of discarding unrelated settings.
config.toml and auth.json contain user-level configuration and credentials. Do not commit them to Git, send them in chat, or expose them in screenshots.
Copy configuration from the website's API Key page
The website's API Key page generates configuration from the current key's actual group and public service URL. This is more reliable than hard-coding a model and URL:
- Sign in to the website and open the API Key page.
- Find the Regular API key and select Use Key.
- Select Codex CLI.
- Choose the Codex authentication mode and operating system.
- Save the generated
config.tomlandauth.jsonin the indicated user directory. - Restart the Codex client you use and follow its verification steps below.
The website's API Key page provides compatibility authentication by default and may also offer API Key mode. These modes generate different provider authentication fields. Copy config.toml and auth.json together from the same mode; do not combine them across modes.
If CC Switch is installed, you can use Import to CCS on the website's API Key page to open the import flow. After confirming the import, select Enable in CC Switch. See Configure CC Switch.
File locations
| System | config.toml | auth.json |
|---|---|---|
| macOS / Linux | ~/.codex/config.toml | ~/.codex/auth.json |
| Windows | %USERPROFILE%\.codex\config.toml | %USERPROFILE%\.codex\auth.json |
If Codex has already been used or configured, ~/.codex will normally exist and does not need to be recreated. Run mkdir -p ~/.codex only when the directory is missing and the configuration files cannot be saved.
On Windows, press Win + R and enter %USERPROFILE%\.codex. Create the directory if it does not exist.
These are user-level provider settings. Do not put model_provider, model_providers, or provider authentication in a project's .codex/config.toml.
Manual configuration example
The following example matches the compatibility authentication mode generated on the website's API Key page. The service URL and model may vary by deployment or key group. If the generated output differs, use that output and the result of GET /v1/models.
~/.codex/config.toml:
model_provider = "OpenAI"
model = "gpt-5.5"
review_model = "gpt-5.5"
model_reasoning_effort = "xhigh"
windows_wsl_setup_acknowledged = true
[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.llmapi.site"
wire_api = "responses"
requires_openai_auth = true
[features]
goals = true~/.codex/auth.json:
{
"OPENAI_API_KEY": "YOUR_API_KEY"
}Replace YOUR_API_KEY with the Regular API key. If gpt-5.5 is not returned for this key, change both model and review_model to an available Responses model.
Verify the configuration
You can first confirm that the key can list the intended model:
curl https://api.llmapi.site/v1/models \
-H 'Authorization: Bearer YOUR_API_KEY'Then verify the client you actually use. You do not need to install Codex CLI just to verify Codex Desktop or an IDE extension.
Codex CLI
Confirm that the command is available:
codex --versionThen enter a project directory and run:
codexCodex Desktop
Fully quit and reopen Codex Desktop, create a new task, and confirm that it receives a response.
Codex IDE extension
Reload the editor window or restart the editor, create a new task, and confirm that it receives a response.
Troubleshooting
| Symptom | Resolution |
|---|---|
| Codex opens the official sign-in flow | Check that config.toml and auth.json exist in the user directory, both files are valid, and their provider settings came from the same authentication mode. |
The API returns 401 | Check that the key in auth.json is complete and active. |
| Codex reports that the model does not exist | Query GET /v1/models with the same key, set model and review_model to a returned model, or copy a fresh configuration from the website's API Key page. |
| Changes are ignored | Fully quit Codex CLI, Codex Desktop, and the IDE extension, then restart. Confirm that you edited the user directory rather than a project directory. |
For current Codex configuration field behavior, see OpenAI's official configuration reference.