Luxeno Docs

Codex CLI

Configure the OpenAI Codex CLI to use Luxeno as its backend. Codex respects the standard OPENAI_BASE_URL environment variable, making setup straightforward.

Prerequisites

Before you begin

  • Codex CLI installed (codex --version should succeed)
  • A Luxeno API key — see Getting Started if you do not have one yet
  • A positive Luxeno balance for requests to succeed

Configuration

Step 1

Export environment variables

The quickest way to configure Codex is to export two environment variables in your shell. Replace sk-silk-your-key-here with your actual Luxeno API key.

Terminal
export OPENAI_BASE_URL=https://luxeno.ai/api/v1
export OPENAI_API_KEY=sk-silk-your-key-here

Add these lines to your ~/.bashrc or ~/.zshrc to make them permanent across sessions.

Step 2

Or configure via config file

Alternatively, create or edit ~/.codex/config.json with the following content:

~/.codex/config.json
{
  "model": "luxeno/glm-4-flash",
  "provider": {
    "name": "openai-compatible",
    "baseURL": "https://luxeno.ai/api/v1",
    "apiKey": "sk-silk-your-key-here"
  }
}

The config file takes precedence over environment variables when both are present.

Step 3

Restart your terminal

If you used environment variable exports, open a new terminal session (or run source ~/.bashrc) so the variables are available to the Codex process.

Verify It Works

Run a simple prompt to confirm the configuration is working:

Terminal
codex "Say hello"

You should receive a response in a few seconds. Check your Luxeno dashboard to confirm token usage was recorded under your account.

Troubleshooting

Common errors

  • 401 Unauthorized verify your API key is correct and that OPENAI_API_KEY is set in the current shell session.
  • Connection refused / 404 double-check that OPENAI_BASE_URL ends in /v1 (no trailing slash).
  • 402 Payment Required your Luxeno balance is zero. Top up from the Billing page.
  • Environment variables not picked up run echo $OPENAI_BASE_URL to confirm the variable is visible in the current session.