Skip to content

Codex CLI Setup

Codex CLI is OpenAI's official command-line coding tool. RouterBus exposes an OpenAI-compatible API (including the Responses API), so Codex CLI works against it directly.

Prerequisites

  • Codex CLI installed
  • An API key created on RouterBus

Configuration

Option 1: environment variables

Add to your shell profile:

bash
export OPENAI_BASE_URL=https://www.routerbus.com/v1
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Reload:

bash
source ~/.bashrc

Option 2: config file

Edit ~/.codex/config.toml and add RouterBus as a custom provider:

toml
model = "gpt-5.5"
model_provider = "routerbus"

[model_providers.routerbus]
name = "RouterBus"
base_url = "https://www.routerbus.com/v1"
env_key = "OPENAI_API_KEY"

env_key names the environment variable the key is read from, so OPENAI_API_KEY still has to be set. Use a model ID from Model Square for model.

Check your version's format

Codex CLI's configuration format moves quickly. If these field names do not match your version, check its documentation — only two things matter: the base URL is https://www.routerbus.com/v1, and the key is your RouterBus API key.

Verify

bash
codex "hello world"

Examples

bash
# Generate code
codex "write a quicksort in Python"

# Explain code
codex "explain this code" < main.py

# Interactive mode
codex

Include /v1

OpenAI-compatible clients normally expect the address to end in /v1. Using https://www.routerbus.com alone tends to produce wrong paths or connection failures.

Choosing a model

Codex CLI defaults to GPT models. The GPT and code models available on RouterBus are listed in Model Square — copy an ID into the model field or the --model flag.

RouterBus API Documentation