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

# Codex

> Install Codex CLI and connect it to Floodgate.

Codex works best with **`gpt-6-sol`** through Floodgate, with support for **`gpt-6-astra`**, **`gpt-6-luna`**, and **`gpt-5.6-sol`**.

## 1. Install Codex

<CodeGroup>
  ```bash macOS, Linux, or WSL theme={null}
  curl -fsSL https://chatgpt.com/codex/install.sh | sh
  ```

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

Check the installation:

```bash theme={null}
codex --version
```

## 2. Set your API key

<CodeGroup>
  ```bash macOS, Linux, or WSL theme={null}
  export FLOODGATE_API_KEY="YOUR_API_KEY"
  ```

  ```powershell Windows PowerShell theme={null}
  $env:FLOODGATE_API_KEY = "YOUR_API_KEY"
  ```
</CodeGroup>

## 3. Configure Floodgate

Open `~/.codex/config.toml`. On Windows, use `%USERPROFILE%\.codex\config.toml`.

```toml theme={null}
model = "gpt-6-sol"
model_provider = "floodgate"

[model_providers.floodgate]
name = "Floodgate"
base_url = "https://api.floodgate.dev/v1"
env_key = "FLOODGATE_API_KEY"
wire_api = "responses"
```

<Warning>
  Put the provider configuration in your user-level config (`~/.codex/config.toml`). Codex ignores custom provider and credential settings in project-level `.codex/config.toml` files.
</Warning>

## 4. Run Codex

```bash theme={null}
cd /path/to/your/project
codex
```

Switch to another Floodgate model for a specific session:

```bash theme={null}
# Maximum capability for difficult architecture & multi-step planning
codex -m gpt-6-astra

# Lightweight, high-speed execution for simple scripts & quick answers
codex -m gpt-6-luna

# Fast open-weight alternatives
codex -m deepseek-v4.1-flash
codex -m claude-opus-5-5
```

<Tip>
  `gpt-6-sol` is the recommended default for Codex, offering frontier coding accuracy and seamless tool calling through Floodgate's `/v1/responses` wire API.
</Tip>

Inside Codex, run `/status` to confirm the selected model and provider.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.