Codex
Codex is a desktop AI programming agent developed by OpenAI that supports connecting to third-party model providers through configuration files. Its configuration method is the same as Codex CLI.
Prerequisites
- You have activated a TCB environment and obtained the environment ID
cloudBaseEnvID - Enable the required model in the AI console
- Obtain the
Base URLandAPI Keyin the AI console
Configuration Steps
Codex shares the same config.toml configuration file with Codex CLI.
Configuration field reference
| Field | Description |
|---|---|
| model | Model ID, copy the enabled model identifier from the AI Console model list |
| model_provider | Provider ID, pointing to the custom [model_providers] configuration |
| base_url | Model Base URL, obtained from the AI Console |
| experimental_bearer_token | API Key for calling the model, obtained from the AI Console |
- Open or create the configuration file
note
If browsing for the file, your file browser may hide files starting with ".". You may need to enable showing hidden files.
On Mac, use Finder shortcut Command + Shift + .. On Windows, check "File Explorer - View - Show - Hidden items".
- Mac/Linux path
~/.codex/config.toml
- Windows path
C:\Users\<your-username>\.codex\config.toml
- Add or modify the following configuration
model = "hy3-preview"
model_provider = "cloudbase"
[model_providers.cloudbase]
name = "CloudBase"
base_url = "https://{{cloudBase-env-ID}}.api.tcloudbasegateway.com/v1/ai/cloudbase"
experimental_bearer_token = "eyJhbGciOiJSUzI1N..."
- Restart Codex
After configuration is complete, restart Codex to start using CloudBase models for programming conversations.
Troubleshooting
| Error | Solution |
|---|---|
404 model not found | Base URL is incorrect, please copy the correct Base URL from the AI Console |
401 Credentials are invalid | API Key is incorrect or may have been deleted |
429 Token usage exceeded quota limit | Model name is incorrect, or the model is not enabled in the AI Console |
| Model not responding | Verify the model name is correct and the model is enabled in the console |