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

# Codex

> Connect the Codex CLI and IDE extension to the LLM Gateway

You need an [LLM Gateway key](https://docs.getunbound.ai/llm-gateway/keys.md#create-a-key).

## Setup

1. Add the gateway as a provider in `~/.codex/config.toml`:

   ```toml ~/.codex/config.toml theme={null}
   model_provider = "unbound"
   model = "gpt-5"

   [model_providers.unbound]
   name = "Unbound"
   base_url = "https://api.getunbound.ai/v1"
   env_key = "UNBOUND_API_KEY"
   wire_api = "responses"
   ```

2. Set the key in your shell profile:

   ```bash theme={null}
   export UNBOUND_API_KEY=<your-key>
   ```

3. Open a new terminal and run `codex`.

Codex reads providers only from `~/.codex/config.toml`. A project's `.codex/config.toml` can't set them.

## Choose models

Set `model` to an OpenAI model, or an [alias](https://docs.getunbound.ai/llm-gateway/models.md#aliases) that sends to one. You can also start Codex with `codex -m <model>`. The `/model` picker shows Codex's built-in list, not your gateway's models.

## Check it works

Send a prompt. In **LLM Gateway → Keys**, the key's **Last Used** updates.


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