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

# Codex

> Configure Codex to use Capriole AI.

## What is Codex

Codex is OpenAI's coding agent for software development. It can use Capriole AI through a custom model provider configured to send requests to Capriole AI's Responses-compatible API.

## Prerequisites

Before you begin, make sure you have:

* A Capriole AI account ([Sign up here](https://capriole.ai))
* A Capriole AI API key ([Get your key](https://capriole.ai?view=api))

## Installation

### Codex CLI

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

### Codex app

Download the app from [OpenAI Codex](https://developers.openai.com/codex).

## Configuration

Create or update `~/.codex/config.toml`:

```toml theme={null}
model = "openai-latest"
model_reasoning_effort = "high"
model_provider = "capriole_ai"

[model_providers.capriole_ai]
name = "Capriole AI"
base_url = "https://api.caprioletech.com/v1"
wire_api = "responses"
env_key = "CAPRIOLE_AI_API_KEY"
env_key_instructions = "Export CAPRIOLE_AI_API_KEY before starting Codex"
```

## Run Codex

Set your API key, then start Codex:

```bash theme={null}
export CAPRIOLE_AI_API_KEY="YOUR_CAPRIOLE_AI_API_KEY"
codex
```

## Supported models

Codex supports Capriole AI OpenAI models through the Responses API. Use `openai-latest` for new setups so Capriole AI can route Codex to our recommended flagship OpenAI model without changing your config.

* `openai-latest`
* `openai/gpt-5.6-terra`
* `openai/gpt-5.6-luna`
* `openai/gpt-5.5`
* `openai/gpt-5.4-mini`

## Troubleshooting

### Why does Codex return an authentication error?

Confirm that `CAPRIOLE_AI_API_KEY` is exported in the same shell before running `codex`.

### Why can't Codex find the model?

Confirm that `model_provider = "capriole_ai"` is set and that `model` is `openai-latest` or a supported Capriole AI OpenAI model ID.

### Why do requests fail with endpoint or protocol errors?

Confirm that `base_url = "https://api.caprioletech.com/v1"` and `wire_api = "responses"` are set under `[model_providers.capriole_ai]`.

### Why does Codex ignore the Capriole AI provider?

Do not use a reserved built-in provider ID such as `openai`; keep the custom provider ID as `capriole_ai`.

### Why don't config changes apply?

Confirm that `~/.codex/config.toml` is the active user config file, trust the project before relying on project-scoped `.codex/config.toml`, then restart Codex.

## Notes

* The configuration uses `env_key` so your API key stays in your shell environment instead of the config file.
* Official references: [Codex CLI](https://developers.openai.com/codex/cli), [Codex config basics](https://developers.openai.com/codex/config-basic), [Codex config reference](https://developers.openai.com/codex/config-reference), and [sample configuration](https://developers.openai.com/codex/config-sample).
