Skip to content

Command-line agents

Codex

Route OpenAI Codex through NoviaHub — install it, write config.toml, set the environment variable, verify and switch models.

Codex is OpenAI’s coding agent, available in the terminal as the Codex CLI. Its config file can add custom model providers, which it calls over the Responses protocol. Point a provider at NoviaHub and Codex uses your NoviaHub balance.

终端窗口
curl -fsSL https://chatgpt.com/codex/install.sh | sh
  1. Store the key in the environment variable NOVIAHUB_API_KEY. Codex reads the key from an environment variable; don’t write the key into the config file.

    终端窗口
    # macOS uses zsh by default; with bash on Linux, use ~/.bashrc instead of ~/.zshrc
    echo 'export NOVIAHUB_API_KEY="sk-..."' >> ~/.zshrc
    source ~/.zshrc
  2. Edit the config file ~/.codex/config.toml (%USERPROFILE%\.codex\config.toml on Windows), creating it if needed:

    ~/.codex/config.toml
    model = "gpt-6-sol"
    model_provider = "noviahub"
    [model_providers.noviahub]
    name = "NoviaHub"
    base_url = "https://noviahub.com/v1"
    env_key = "NOVIAHUB_API_KEY"
    wire_api = "responses"
    Setting Purpose
    model The default model ID.
    model_provider Which provider to use; matches noviahub in [model_providers.noviahub] below.
    name The provider’s display name.
    base_url The API address, including /v1: https://noviahub.com/v1.
    env_key The environment variable that holds the key.
    wire_api The protocol. The docs say responses is the only supported value and the default when omitted.
  3. Open a new terminal and run codex.

  1. Type /status in Codex and check that the active model is the one you set.

  2. Ask anything. A normal answer means it works; the call and its cost appear under Usage Logs in the NoviaHub console.

  3. If the configuration doesn’t take effect, /debug-config shows the config layers Codex actually loaded.

  • For now: type /model in Codex.
  • Permanently: change model in config.toml.

Codex only uses Responses, so choose models whose endpoint labels include Response. On 2026-09-28 those on NoviaHub were gpt-6-sol, gpt-6-luna, gpt-6-astra, gpt-5.6-sol, gpt-5.6-luna, gpt-5.6-terra, deepseek-v4-flash, deepseek-flash, deepseek-v4-flash-vision-exp and kimi-k3. Models change; Models & Pricing is authoritative. A model without Responses support will fail.

401 Invalid token First check that NOVIAHUB_API_KEY is set in the new terminal (on macOS / Linux, run echo $NOVIAHUB_API_KEY), then check on the API Keys page that the key is Enabled.

403 insufficient_user_quota Your account balance has run out. Top up first.

Codex in the ChatGPT desktop app The docs say the ChatGPT desktop app reads the same ~/.codex/config.toml. The steps on this page cover the command line only.

Checked on 2026-09-28: