Integration guide

Run the Codex CLI on OpenLux models

The Codex CLI speaks any OpenAI-compatible endpoint. One provider block in ~/.codex/config.toml lets your terminal agent run on GPT-6 Astra, Claude Sonnet 4.5, DeepSeek V4 or any other OpenLux model — metered per token on one key.

Create an API key Read the docs

Abstract orange glass sculpture illustrating the OpenAI Codex CLI integration with OpenLux
OpenAI Codex CLI + OpenLux — one key, one endpoint, one bill.

Set it up in four steps

1

Install the Codex CLI

Install with npm (npm install -g @openai/codex) or Homebrew, then run it once so the config directory is created.

2

Create an OpenLux key

Sign in to the console and create an API key. Billing is pay as you go, and free trial credit covers your first runs.

3

Register OpenLux as a provider

Open ~/.codex/config.toml and add a model_providers entry with the OpenLux base URL and an environment variable for the key.

4

Run Codex on OpenLux

Export OPENLUX_API_KEY and start codex. Switch models with the --model flag or by editing one line of the config; everything else works exactly as before.

Configuration

Copy these blocks, replace the placeholder key and you are done.

~/.codex/config.toml

model = "gpt-6-astra"
model_provider = "openlux"

[model_providers.openlux]
name = "OpenLux"
base_url = "https://openlux.lol/v1"
env_key = "OPENLUX_API_KEY"
wire_api = "chat"

Terminal

export OPENLUX_API_KEY="sk-openlux-..."
codex

Models that fit OpenAI Codex CLI

GPT-6 Astra

OpenAI · $0.3677 / 1M tokens

Claude Sonnet 4.5

Anthropic · $0.2647 / 1M tokens

DeepSeek V4

DeepSeek · $0.0613 / 1M tokens

Gemini 3.8 Flash

Google · $0.0551 / 1M tokens

The full list is in the model catalogue and the use-case collections.

OpenAI Codex CLI + OpenLux questions

Does the Codex CLI work with any OpenAI-compatible gateway?

Yes. Codex resolves model providers from ~/.codex/config.toml, and a provider block with a base_url and env_key is all it needs. OpenLux serves /v1/chat/completions, so wire_api stays "chat".

Which OpenLux models are best for terminal coding agents?

Claude Sonnet 4.5 and GPT-6 Astra lead for code edits and planning, DeepSeek V4 and Qwen3 Max are strong budget picks, and the flash-tier Gemini models keep long agent loops cheap.

How do I switch models mid-project?

Either edit the model line in config.toml or pass --model at launch, for example codex --model claude-sonnet-4-5-20250929. The provider stays the same, so context and workspace settings are unaffected.

What does running Codex through OpenLux cost?

Per-token rates from $0.0368 per 1M tokens (Gemini 3 Flash preview) up to $0.4412 (Claude Opus 5), all discounted against official pricing, with every request itemised in the console.

How much will this cost?

Estimate Codex CLI cost

Model tasks, tokens, retries and monthly team spend before rollout.

Open the cost guide

Add AI review to the pull-request loop

Build a bounded code reviewer

Use the same OpenAI-compatible endpoint to review pull-request diffs, publish findings and estimate the review budget.

Open the AI code review guide

Connect OpenAI Codex CLI to OpenLux today

One key covers every model in this guide and the rest of the catalogue, metered in USD with free trial credit to start.

Create an API key See pricing