Skip to content

Codex CLI

Codex supports custom providers in its configuration file. You declare Kloria once, and Codex uses it by default.

  1. Install Codex

    Fenêtre de terminal
    npm install -g @openai/codex

    On macOS, brew install --cask codex works too.

  2. 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 ~/.zshrc or ~/.bashrc, then open a new terminal:

    Fenêtre de terminal
    export KLORIA_API_KEY="sk-…"
  3. 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.

  4. Start Codex

    Fenêtre de terminal
    codex

    Send a short message. If Codex replies, the connection goes through Kloria: the request shows up under Usage Logs in the console.

  • At launch: codex --model gpt-5.6-terra.
  • Permanently: edit the model line of the configuration file.

Available GPT IDs are on Models and pricing.

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.
© 2026 Kloria — private beta