Codex CLI
Codex supports custom providers in its configuration file. You declare Kloria once, and Codex uses it by default.
-
Install Codex
Fenêtre de terminal npm install -g @openai/codexOn macOS,
brew install --cask codexworks too.Fenêtre de terminal npm install -g @openai/codexYou need Node.js and npm installed.
-
Put your key in an environment variable
Codex reads the key from the variable named in its configuration. We use
KLORIA_API_KEY.Add this line to your
~/.zshrcor~/.bashrc, then open a new terminal:Fenêtre de terminal export KLORIA_API_KEY="sk-…"Fenêtre de terminal [Environment]::SetEnvironmentVariable("KLORIA_API_KEY", "sk-…", "User")Then open a new terminal so the variable is visible.
-
Declare Kloria in the Codex configuration
Open (or create) the user configuration file:
- macOS / Linux:
~/.codex/config.toml - Windows:
%USERPROFILE%\.codex\config.toml
~/.codex/config.toml model = "gpt-6.1-sol"model_provider = "kloria"[model_providers.kloria]name = "Kloria"base_url = "https://api.kloria.dev/v1"env_key = "KLORIA_API_KEY"wire_api = "responses"The first two lines must stay at the top of the file, before any bracketed section.
- macOS / Linux:
-
Start Codex
Fenêtre de terminal codexSend a short message. If Codex replies, the connection goes through Kloria: the request shows up under Usage Logs in the console.
Switching models
Section titled “Switching models”- At launch:
codex --model gpt-5.6-terra. - Permanently: edit the
modelline of the configuration file.
Available GPT IDs are on Models and pricing.
Not working?
Section titled “Not working?”| Symptom | Check |
|---|---|
| Codex asks you to sign in to ChatGPT | model_provider = "kloria" isn’t read: the line sits under a […] section or in a project file. Move it to the top of the user file. |
Codex reports that KLORIA_API_KEY is missing |
The variable isn’t set in the terminal where you run Codex. Open a new terminal after saving it. |
wire_api = "chat" is no longer supported |
An old configuration is left over. Replace it with wire_api = "responses". |
| 401 error | The key is invalid, disabled or expired. |
| “No available channel for model…” | Wrong model ID, or a Claude model used with Codex. Pick a GPT model from the list. |