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

# Use CerasAI with Codex

> Connect Codex to CerasAI through a LiteLLM Responses API compatibility proxy.

## Before you begin

Create a key on the [API Keys](https://console.cerasai.cloud/keys) page, confirm the model ID
on the [Models](https://console.cerasai.cloud/models) page, and export the key in the shell where you start Codex or its local proxy.

```bash theme={"system"}
export CERASAI_API_KEY="your-key"
```

Codex no longer speaks Chat Completions. `wire_api = "chat"` is rejected at startup, and
`responses` is the only accepted value, so Codex reaches CerasAI through a proxy that
accepts Responses API requests.

> [!WARNING]
>
> This is a compatibility path, not native Responses API support. LiteLLM translates common
> text and function-tool requests, but Responses-only tools and metadata may not map to Chat
> Completions. If your workflow depends on a specific Codex tool, verify it before relying on
> this setup.

**1. Install LiteLLM**

[LiteLLM](https://docs.litellm.ai) bridges the Responses API to Chat Completions.

```bash theme={"system"}
pip install 'litellm[proxy]'
```

> [!WARNING]
>
> Install a current release. LiteLLM 1.82.7 and 1.82.8 were briefly replaced on PyPI in
> March 2026 by a [credential stealer](https://docs.litellm.ai/blog/security-update-march-2026).

**2. Configure the proxy**

The model below is an example, not the full CerasAI catalog. For another model
or tier, replace the ID after `openai/` with one from [Models](https://console.cerasai.cloud/models).
Keep the proxy's `model_name` and the Codex `model` setting consistent.

Give the model the `openai/` prefix and set `use_chat_completions_api`, which bridges
incoming `/v1/responses` requests to CerasAI's `/v1/chat/completions`.

> [accordion] LiteLLM proxy configuration
>
> ```yaml codex.litellm.yaml theme={"system"}
> model_list:
>   - model_name: deepseek-v4.1-flash
>     litellm_params:
>       model: openai/deepseek-ai/DeepSeek-V4.1-Flash-1017
>       api_base: https://api.cerasai.cloud/v1
>       api_key: os.environ/CERASAI_API_KEY
>       use_chat_completions_api: true
>       additional_drop_params: ["reasoning_effort", "client_metadata"]
>
> litellm_settings:
>   drop_params: true
>
> general_settings:
>   master_key: sk-codex-proxy
> ```

`drop_params` discards parameters a model does not accept rather than failing the
request. `additional_drop_params` removes `reasoning_effort`: Codex asks for a reasoning
summary, LiteLLM forwards that request in this field in a form CerasAI rejects, and
Codex works without it. It also removes `client_metadata`, which CerasAI does not
accept as a Chat Completions parameter. `master_key` is the token Codex sends to the proxy, not your
CerasAI key.

**3. Start the proxy**

```bash theme={"system"}
litellm --config codex.litellm.yaml --host 127.0.0.1 --port 4000
```

Leave it running, and confirm it is up. The proxy holds your CerasAI key, so keep it
bound to `127.0.0.1` and do not expose it to a network.

```bash theme={"system"}
curl http://127.0.0.1:4000/health/liveliness
```

**4. Point Codex at it**

> [accordion] Codex configuration
>
> ```toml ~/.codex/config.toml theme={"system"}
> model = "deepseek-v4.1-flash"
> model_provider = "cerasai"
>
> [model_providers.cerasai]
> name = "CerasAI"
> base_url = "http://127.0.0.1:4000/v1"
> env_key = "LITELLM_API_KEY"
> wire_api = "responses"
> requires_openai_auth = false
> ```

`env_key` names the variable holding the proxy's `master_key`, so export that too.

```bash theme={"system"}
export LITELLM_API_KEY="sk-codex-proxy"
codex
```

## Troubleshooting

| Symptom | Cause |
| - | - |
| `wire_api = "chat"` is no longer supported | `base_url` points at CerasAI directly. Point it at the proxy. |
| `404` on `/v1/responses` | The model entry uses `hosted_vllm/`. Codex needs `openai/` with `use_chat_completions_api`. |
| `400` with `No connected db.` | `LITELLM_API_KEY` does not match the proxy's `master_key`. LiteLLM reports the lookup failure, not an auth error. |
| `400` mentioning `reasoning_effort` and `Input should be 'none', 'minimal', ...` | The proxy configuration is missing `additional_drop_params: ["reasoning_effort", "client_metadata"]`. |

Issues common to every agent are listed under [Common issues](https://docs.cerasai.com/agent-integrations#common-issues).


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