Integrations

Codex

Codex is OpenAI's command-line coding agent. It calls GPT models over the Responses protocol, and you connect it to FlyRouter by adding a custom provider to its config file.

Install Codex

npm install -g @openai/codex

Set up FlyRouter

Add a provider

Edit ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml), creating it if needed:

~/.codex/config.toml
model = "gpt-6.1-sol"
model_provider = "flyrouter"

[model_providers.flyrouter]
name = "FlyRouter"
base_url = "https://api.flyrouter.ai/v1"
env_key = "FLYROUTER_API_KEY"
wire_api = "responses"

The provider must be defined in this user-level file. It has no effect in a project's .codex/config.toml.

Set the API key

Codex reads the key from the environment variable named in env_key:

export FLYROUTER_API_KEY="sk-..."

Start Codex

Open a new terminal and run codex in your project. If it shows gpt-6.1-sol as the model, you're set.

Available models

Codex only speaks the Responses protocol, so it can only use GPT models such as gpt-6.1-sol and gpt-6-astra. Switch for one run with codex -m gpt-6-astra, or type /model in a session.

Codex no longer supports wire_api = "chat"; keep it set to "responses". To use Claude in a command-line agent, use Claude Code or OpenCode.

Troubleshooting

Missing environment variable or 401

FLYROUTER_API_KEY isn't set. On macOS and Linux, make sure it's in your shell config and open a new terminal. On Windows, you must open a new terminal after setx.

It still asks me to log in to OpenAI after adding the provider

Make sure requires_openai_auth = true isn't set, and that model_provider is at the very top of the file, before any [...] section.

FlyRouter

One key, every top AI model