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 --versionshould succeed) - A Luxeno API key — see Getting Started if you do not have one yet
- A positive Luxeno balance for requests to succeed
Configuration
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.
export OPENAI_BASE_URL=https://luxeno.ai/api/v1
export OPENAI_API_KEY=sk-silk-your-key-hereAdd these lines to your ~/.bashrc or ~/.zshrc to make them permanent across sessions.
Or configure via config file
Alternatively, create or edit ~/.codex/config.json with the following content:
{
"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.
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:
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_KEYis set in the current shell session. - Connection refused / 404 — double-check that
OPENAI_BASE_URLends 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_URLto confirm the variable is visible in the current session.