> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruoli.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Configure ruoli in OpenAI Codex CLI

[Codex](https://github.com/openai/codex) is an AI coding agent by OpenAI that runs in the terminal.

## Installation

```bash theme={null}
npm install -g @openai/codex
```

## Configure with CC Switch (Recommended)

Open [CC Switch](https://ccswitch.lovable.app) and add a ruoli configuration:

| Field   | Value                  |
| ------- | ---------------------- |
| API URL | `https://ruoli.dev/v1` |
| API Key | Your Key               |

Select Codex and click Apply.

## Manual Configuration

Edit `~/.codex/config.toml`:

```toml theme={null}
model = "claude-sonnet-4-20250514"
model_provider = "ruoli"

[model_providers.ruoli]
name = "ruoli"
base_url = "https://ruoli.dev/v1"
env_key = "ruoli_API_KEY"
wire_api = "responses"
```

Set the environment variable:

```bash theme={null}
export ruoli_API_KEY=sk-YOUR-KEY
```

## Switch Models

Change the `model` field in `config.toml`, or specify it at launch:

```bash theme={null}
codex --model gpt-4o
```

You can also switch models in CC Switch.

<Info>**Official Documentation**: [developers.openai.com/codex](https://developers.openai.com/codex)</Info>
