Skip to main content

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 URL and API Key in the AI console
Base URLhttps://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase

Configuration Steps

Codex shares the same config.toml configuration file with Codex CLI.

Configuration field reference

FieldDescription
modelModel ID, copy the enabled model identifier from the AI Console model list
model_providerProvider ID, pointing to the custom [model_providers] configuration
base_urlModel Base URL, obtained from the AI Console
experimental_bearer_tokenAPI Key for calling the model, obtained from the AI Console
  1. 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
  1. 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..."
  1. Restart Codex

After configuration is complete, restart Codex to start using CloudBase models for programming conversations.

Troubleshooting

ErrorSolution
404 model not foundBase URL is incorrect, please copy the correct Base URL from the AI Console
401 Credentials are invalidAPI Key is incorrect or may have been deleted
429 Token usage exceeded quota limitModel name is incorrect, or the model is not enabled in the AI Console
Model not respondingVerify the model name is correct and the model is enabled in the console