> ## 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.

## Set Up Codex

<Steps>
  <Step title="Get a Modellix API Key">
    Create a key in the [Modellix console](https://modellix.ai/console/api-key). It is not an OpenAI platform key.
  </Step>

  <Step title="Set the API Key">
    Export your Modellix key as `OPENAI_API_KEY`:

    ```bash theme={null}
    export OPENAI_API_KEY="mdlx-xxxxxxxx"
    ```
  </Step>

  <Step title="Configure Base URL and Model">
    In `~/.codex/config.toml`, set the base URL and model. 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). |
  </Step>

  <Step title="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/api).
  </Step>
</Steps>

## Related

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