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

# Codex

> Use Fireworks AI models in OpenAI Codex CLI with the FireConnect CLI

[FireConnect](https://github.com/fw-ai/fireconnect) routes the [OpenAI Codex CLI](https://developers.openai.com/codex) through Fireworks AI models via the Responses API. See the [FireConnect overview](/ecosystem/fireconnect/overview) for install and CLI basics.

## Prerequisites

* [OpenAI Codex CLI](https://developers.openai.com/codex) installed (0.134+)
* A standard [Fireworks API key](https://app.fireworks.ai/settings/users/api-keys) (`fw_...`)
* The FireConnect CLI (see [Install](/ecosystem/fireconnect/overview#install))

<Warning>
  Fire Pass keys (`fpk_...`) are not supported for Codex yet. The `/responses` endpoint requires a standard Fireworks API key.
</Warning>

## Enable Fireworks routing

```bash theme={null}
export FIREWORKS_API_KEY=fw_...
fireconnect codex on
```

Or pass the key once so later model commands reuse it:

```bash theme={null}
fireconnect codex on --api-key fw_...
```

After `fireconnect codex on`, `off`, `model select`, or `model reset`, `config.toml` is updated immediately. To use the updated routing in Codex, run `/model` in the same session, start a new session, or `/exit` and resume with `codex resume <id>`.

## Default model

Codex routes a single default model. The default is `glm-latest`.

```bash theme={null}
fireconnect codex status
```

## What gets written

FireConnect edits `~/.codex/config.toml`:

* Sets root `model_provider` / `model` for Codex 0.134+
* Adds a `[model_providers.fireworks-ai]` block with `wire_api = "responses"`
* With `--api-key` or a key from `~/.fireconnect/config.json`, writes `experimental_bearer_token` so later `model list`, `select`, and `reset` work without passing the key again
* With only `FIREWORKS_API_KEY` in the environment, writes `env_key = "FIREWORKS_API_KEY"` instead

FireConnect snapshots your original `~/.codex/config.toml` before the first change. The snapshot lives in `~/.fireconnect/codex/`. Running `fireconnect codex off` restores it byte-for-byte. Unrelated Codex settings (for example `[[mcp_servers]]`) are preserved via surgical TOML edits.

## Browsing and picking models

```bash theme={null}
fireconnect codex model list              # browse serverless endpoints
fireconnect codex model select            # pick Codex's default model
fireconnect codex model select --search glm
```

## CLI reference

```bash theme={null}
fireconnect codex on              # Enable Fireworks routing
fireconnect codex off             # Restore original config
fireconnect codex status          # Check current provider and model
fireconnect codex model list      # Browse serverless endpoints
fireconnect codex model select    # Pick a model interactively
fireconnect codex model reset     # Reset model to default
fireconnect codex help            # Show harness-specific help
```

Run `fireconnect codex help` for all options.

### Switch models

```bash theme={null}
fireconnect codex on --main glm-5p1
```

### Turn off Fireworks routing

```bash theme={null}
fireconnect codex off
```

This restores your previous `config.toml` from the backup in `~/.fireconnect/codex/`.

### Use a non-default config file

```bash theme={null}
fireconnect codex on --config-path /path/to/config.toml
```

## Source

FireConnect is open source: [github.com/fw-ai/fireconnect](https://github.com/fw-ai/fireconnect)
