Codex CLI

Point OpenAI's Codex CLI at FluxRouter using a custom model provider in config.toml.

Codex CLI talks to FluxRouter through a custom model provider. Change one thing, the base URL, and Codex routes every request through your single Flux key.

One-click with Flux Desktop

If you run Flux Desktop, it writes this Codex configuration for you. The manual steps below are for setting it up by hand.

Manual config

Add a [model_providers.flux] block to ~/.codex/config.toml and point Codex at it:

toml
model = "flux-auto"
model_provider = "flux"

[model_providers.flux]
name = "FluxRouter"
base_url = "https://api.fluxrouter.ai/v1"
env_key = "FLUX_API_KEY"
wire_api = "responses"

Then export your Flux key and run Codex:

bash
export FLUX_API_KEY="sk-YOUR-FLUX-KEY"
codex

Important: Codex uses the Responses API

As of early 2026, Codex removed Chat Completions support. wire_api = "responses" is the only supported value, so Codex hits FluxRouter's /v1/responses route. This works because FluxRouter exposes the Responses API at https://api.fluxrouter.ai/v1.

The provider IDs openai, ollama, and lmstudio are reserved and cannot be reused. Use a custom ID like flux, as shown above.

Test it

Run codex and send a simple prompt. If the response comes back, your traffic is flowing through FluxRouter. Check your dashboard to confirm the request landed.