# Codex

Source: https://docs.aicentos.com/en/clients/codex

Language: en

> Use aicentos in Codex — one-click import with CC Switch, or configure config.toml manually

Codex is compatible with the OpenAI protocol. Point the model provider at aicentos and you can use every model aicentos offers.

Two integration options are provided below: **manage everything with CC Switch** (recommended), or **edit config.toml manually**.

## Option 1: Use CC Switch (recommended)

CC Switch can also manage Codex's provider configuration, letting you switch between multiple setups in one click.

See [Connect with CC Switch →](https://docs.aicentos.com/en/clients/cc-switch)

## Option 2: Manual configuration

### Prerequisites

| Item                         | Value                     |
| ---------------------------- | ------------------------- |
| Provider ID                  | `aicentos`                |
| Provider name                | `aicentos`                |
| Base URL                     | `https://aicentos.com/v1` |
| API Key environment variable | `AICENTOS_API_KEY`        |

First create a dedicated key on the console's "API Keys" page; including `codex` in the name makes usage easier to track.

### Set the API Key

Set the environment variable in your terminal:

```bash
export AICENTOS_API_KEY="sk-your-API-Key"
```

To persist it, add the line to `~/.zshrc` or `~/.bashrc`, then reload:

```bash
source ~/.zshrc
```

Confirm the variable is active:

```bash
echo $AICENTOS_API_KEY
```

### Configure the Codex provider

Edit `~/.codex/config.toml` and add:

```bash
model = "your-model-name"
model_provider = "aicentos"

[model_providers.aicentos]
name = "aicentos"
base_url = "https://aicentos.com/v1"
env_key = "AICENTOS_API_KEY"
wire_api = "responses"
```

Replace `your-model-name` with a model name listed in the Model Gallery of the console; see [Supported models](https://docs.aicentos.com/en/billing/models-list).

### Launch Codex

```bash
codex
```

Send a simple request to confirm the provider works.

## Troubleshooting

When a request fails, compare Codex's terminal output with the usage logs in the console. Common causes:

* The model name is wrong (follow the Model Gallery).
* The Base URL format is wrong (fill in only up to `/v1`; do not add extra paths).
* The environment variable was not picked up by the current terminal (reopen the terminal or `source` the config file).