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

# Codex

> Run OpenAI's Codex CLI on any model in the Opper catalog

[Codex](https://openai.com/codex/) is OpenAI's open-source coding agent for the terminal (Apache-2.0, [source](https://github.com/openai/codex)). It works from natural-language instructions to edit code across your project, run commands, and complete tasks end to end.

Codex reads its model providers from a config file, so adding Opper as one provider lets you run it on Claude, Gemini, DeepSeek, or any other model in the catalog.

## Setup

<Tip>
  One command, no config files:

  ```bash theme={null}
  npx @opperai/cli launch codex --model anthropic/claude-opus-4-8
  ```

  This writes a `[model_providers.opper]` block into `~/.codex/config.toml` and starts Codex. `--model` is optional.
</Tip>

To configure it by hand, add the provider to `~/.codex/config.toml`:

```toml theme={null}
model_provider = "opper"

[model_providers.opper]
name = "Opper"
base_url = "https://api.opper.ai/v3/compat"
env_key = "OPPER_API_KEY"
```

Then export your key and start Codex:

```bash theme={null}
export OPPER_API_KEY=your-opper-api-key
codex --model anthropic/claude-opus-4-8
```

## Choosing a model

Pass any Opper model ID with `--model`, or set a default in `config.toml`:

```toml theme={null}
model = "anthropic/claude-sonnet-4-6"
```

Codex needs tool calling and streaming — pick a model the catalog marks with the `tools` capability. Browse IDs in the [model catalog](/capabilities/models).

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    Check that `OPPER_API_KEY` is exported in the shell running Codex, and that `env_key` in `config.toml` names that same variable. Opper keys start with `op-`.
  </Accordion>

  <Accordion title="404 Model Not Found">
    Copy the model ID exactly from the [catalog](/capabilities/models) — it includes the provider prefix, as in `anthropic/claude-sonnet-4-6`.
  </Accordion>

  <Accordion title="Codex ignores the provider">
    `model_provider = "opper"` has to sit at the top level of `config.toml`, not inside the `[model_providers.opper]` table. TOML tables capture every key that follows them.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Traces" icon="chart-line" href="/control-plane/trace">
    Every Codex call, with model, latency, and tokens.
  </Card>

  <Card title="All integrations" icon="plug" href="/integrations/overview">
    Every app that runs on Opper.
  </Card>
</CardGroup>
