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

# Use Modellix LLM with Codex CLI

> Configure Codex to use Modellix by setting OPENAI_API_KEY and openai_base_url in ~/.codex/config.toml with openai/... models.

Point [Codex CLI](https://github.com/openai/codex) at the Modellix LLM gateway so chat and coding requests use your Modellix API key and `openai/...` models over OpenAI-compatible Chat Completions.

## Configure

Set your API key in the environment:

```bash theme={null}
export OPENAI_API_KEY="mdlx-xxxxxxxx"
```

In `~/.codex/config.toml`, set the base URL and model (recommended). Newer Codex builds deprecate `OPENAI_BASE_URL` as an environment variable—prefer `openai_base_url` in config:

```toml theme={null}
model = "openai/gpt-5.5"
openai_base_url = "https://llm.modellix.ai/v1"
```

| Setting           | Value                                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| `openai_base_url` | `https://llm.modellix.ai/v1`                                                                           |
| `OPENAI_API_KEY`  | Modellix API Key                                                                                       |
| `model`           | `openai/...` (for example `openai/gpt-5.5`). See [Models & Pricing](/llm/overview#models-and-pricing). |

<Note>
  Get a Modellix API key from the [console](https://modellix.ai/console/api-key). It is not an OpenAI platform key.
</Note>

## Verify

After saving the config, run Codex as usual. Traffic should hit `https://llm.modellix.ai/v1` (typically Chat Completions). For protocol details, see [Chat Completions](/llm/chat-completions) and the [LLM API guide](/llm/api).

## Related

* [OpenAI SDK](/llm/openai-sdk) — same `/v1` base URL for application code
* [OpenCode](/llm/opencode) — another OpenAI-compatible client config
* [Cursor](/llm/cursor) — IDE OpenAI-compatible provider setup
