# Codex

Configure Codex CLI with a Felo custom model provider.

Use this guide to route Codex model calls through Felo and install the Felo Skill. The FeloAPI CLI writes the default client configuration and backs up the file it replaces.

## Before you start

- A Felo API key: [create one](https://openapi.felo.ai/console/api-keys).
- [Node.js 22 or newer](https://nodejs.org/en/download) if you use the FeloAPI CLI.
- Codex installed.

## What you need

| Item | Value |
| --- | --- |
| Protocol | OpenAI-compatible Responses API |
| Base URL | `https://openapi.felo.ai/api/v1` |
| Model example | `gpt-5.6-sol` |
| Felo Skill location | `~/.codex/skills/feloapi` |

## Option 1: automatic setup

```bash
npm install -g feloapi-cli@latest
feloapi setup --agent codex --model MODEL_ID --allow-network
```

The CLI writes Felo as the default model provider, saves a backup of the previous configuration, and installs the Skill. Open **Codex** normally — no wrapper command is needed. Run `feloapi use official` to restore your original configuration, and `feloapi use felo` to apply Felo again. `feloapi disconnect codex --yes` removes both the Skill and the backup.

## Option 2: manual configuration

Add Felo to your user-level `~/.codex/config.toml`, keeping your other settings:

```toml
model = "MODEL_ID"
model_provider = "feloapi"

[model_providers.feloapi]
name = "Felo API"
base_url = "https://openapi.felo.ai/api/v1"
wire_api = "responses"
requires_openai_auth = false
http_headers = { Authorization = "Bearer YOUR_API_KEY" }
```

The key is stored in the Codex configuration; keep the file private (`chmod 600 ~/.codex/config.toml`). Run `codex` normally. For sandboxed `codex exec`, add `[sandbox_workspace_write]` with `network_access = true` or run setup with `--allow-network`. If you use a top-level Codex `profile`, remove it or select Felo explicitly with `codex --profile feloapi`.

## Verify

```bash
feloapi doctor --agent codex
```

Open Codex and ask a small question, for example: “Review this repository and list the main files.” If it answers, the setup works. For non-interactive checks, `codex exec "Review this repository"` should also work.

## Switch back to the official model

```bash
feloapi use official --agent codex    # restore the previous client config
feloapi use felo --agent codex        # switch to Felo again
```



Re-running setup replaces the managed configuration; the original backup is kept until `disconnect`.

## Troubleshooting

| Issue | What to do |
| --- | --- |
| `feloapi: command not found` | Reopen the terminal and retry; install with `npm install -g feloapi-cli@latest`. |
| Node.js is older than 22 | Install the LTS version from [nodejs.org](https://nodejs.org/en/download) and reopen the terminal. |
| The client ignores the provider | Make sure the Felo provider/model is selected, and remove conflicting `ANTHROPIC_*` or `OPENAI_*` environment variables. |
| Authentication fails | Create a new key, run `feloapi auth login`, then `feloapi use felo`. |
| Skill is missing | Start a new Codex session; Skills are discovered at startup. |

## Related

- [FeloAPI CLI guide](https://openapi.felo.ai/docs/cli.md)
- [Models and pricing](https://openapi.felo.ai/docs/guides/models-and-pricing.md)
- [Other AI tools](https://openapi.felo.ai/docs/agent-clients/other-tools.md)
