Codex CLI
Use aicentos in Codex CLI — manually configure model_providers in config.toml
Last updated:
Codex CLI is OpenAI's official command-line coding agent; model providers are defined in ~/.codex/config.toml. Point a custom provider at aicentos and the models aicentos offers become usable in the terminal.
If you prefer managing multiple configurations graphically, CC Switch offers one-click switching; this guide covers manual configuration only.
Prerequisites
First create a dedicated key for Codex CLI on the console's "API Keys" page (naming it codex-cli makes usage easier to track):
- Console: https://aicentos.com
- Create a key: https://aicentos.com/keys
- Top up when the balance runs out: https://aicentos.com/wallet
Confirm Codex CLI is installed:
codex --versionConfiguration to fill in
| Field | Value |
|---|---|
| Provider ID | aicentos |
| Provider name | aicentos |
| API Key environment variable | AICENTOS_API_KEY |
| Base URL | https://aicentos.com/v1 |
| Model | A model name from the Model Gallery in the console |
Setup steps
1. Set the API Key environment variable
export AICENTOS_API_KEY="sk-your-API-Key"To persist it, add the line to ~/.zshrc or ~/.bashrc, source the file, and verify with echo $AICENTOS_API_KEY.
2. Edit config.toml
Add the following to ~/.codex/config.toml:
model = "your-model-name"
model_provider = "aicentos"
[model_providers.aicentos]
name = "aicentos"
base_url = "https://aicentos.com/v1"
env_key = "AICENTOS_API_KEY"
wire_api = "responses"Replace your-model-name with a model name listed in the Model Gallery of the console; see Supported models.
3. Start Codex
codexSend a simple request to confirm the provider works.
Test
codex exec "Answer in one sentence: what is 1+1?"A normal response means the integration works. The response consumes a small amount of quota, which you can check in the console's usage logs.
Notes
- Enter the Base URL only up to
/v1— do not extend it to the full/v1/chat/completionspath. - Fields such as
base_urlandenv_keyonly take effect in the user-level~/.codex/config.toml. A.codex/config.tomlinside the project is ignored and may trigger a startup warning. - Set
wire_apitoresponses, which corresponds to aicentos' Responses API. The official documentation currently only supports this value; if your version reportsunknown variant, the CLI is too old — upgrade first. openai,ollamaandlmstudioare reserved provider IDs. You cannot repoint the built-inopenaiprovider's base_url at a third-party gateway; you must create a new provider name (aicentosin this guide).- Troubleshooting order: does the model name match the console → is the Base URL only up to
/v1→ are the environment variables visible in the terminal that launched codex → is the account balance sufficient.