Skip to content

Codex Integration

This guide shows how to configure Codex CLI to use model capabilities through the unified R9S API.

Before you start, make sure you have:

  1. Codex CLI installed

    Follow the official Codex CLI installation instructions to install Codex locally.

  2. An R9S API key

    Sign in to the R9S platform, create an API key, and copy it.

    Store this key securely. Codex will read it from an environment variable.

Edit your Codex configuration file:

Terminal window
vim ~/.codex/config.toml

Add the following configuration:

model_provider = "r9s"
model_reasoning_effort = "high"
model = "gpt-5.3-codex"
web_search = "disabled"
[model_providers.r9s]
name = "R9S"
base_url = "https://api.r9s.ai/v1"
env_key = "R9S_API_KEY"

Configuration notes:

  • model_provider must match the provider name under [model_providers.r9s].
  • env_key is the environment variable name that stores your API key. Do not put the API key itself in config.toml.
  • To switch models, update the model value in config.toml.

For the current terminal session, set:

Terminal window
export R9S_API_KEY="YOUR_R9S_API_KEY"

Replace YOUR_R9S_API_KEY with your actual R9S API key.

For long-term use, add the export command to your shell configuration file, such as ~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish.

Set the environment variable before starting Codex. Codex reads the API key from the variable specified by `env_key`.

Open your project directory and start Codex:

Terminal window
cd /path/to/your/project
codex

If the configuration is correct, Codex will send model requests through the R9S API.