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

CC Switch is an open-source desktop application for centrally managing provider configurations for multiple AI coding tools. For installation instructions, refer to the CC Switch configuration guide.

  1. Open CC Switch and add CloudBase as a provider
FieldDescription
API KeyObtained from the AI console
Base URLhttps://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase
API FormatChat Completions (requires local routing)
  1. Enable local route mapping in advanced options and enter the model ID

  2. Switch to the CloudBase provider and restart Codex

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