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

# Codex

> Connect Codex to your downloaded Magnitude models.

## Connect

1. [Install Codex](https://developers.openai.com/codex/cli) if needed.
2. Download a compatible model in Magnitude.
3. Open **Connections → Codex** and click **Connect**.
4. Select a downloaded model on the connected card, then click the command to copy it.
5. Paste it into your terminal from your project folder. On Windows, use PowerShell.

Magnitude configures Codex’s local gateway and model catalog. Local model IDs use the `magnitude-local/` prefix inside Codex. Keep Magnitude running while connected, including when you select a hosted model: hosted requests pass through the gateway to their provider. Disconnect in Magnitude and restart Codex before using it independently again.

## Run Codex

After connecting in Magnitude, start Codex with:

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
codex -c model_provider=magnitude --model magnitude-local/MODEL_ID
```

Replace `MODEL_ID` with the exact model ID, such as `gemma-4-e2b-it-qat:gguf:q4`, rather than its display name. The command shown in **Connections** already includes the correct ID for your selected model, so you can copy it without editing. Keep Magnitude running; it loads the model when the agent requests it.

## Configuration

**Connect** writes `~/.codex/config.toml`, `~/.codex/magnitude.config.toml`, and `~/.codex/magnitude.models.json`. Location overrides: `CODEX_HOME`.

### On another computer

1. In Magnitude, turn on **Settings → Network access**.
2. On the other computer, open `http://ADDRESS:10100` in a browser, using the address from **Reachable at**, and sign in with the **API key**.
3. In **Connections**, click **Copy setup prompt** on Codex and send it to your agent.

### Edit the files yourself

Use the address from **Reachable at** for `ADDRESS` and the **API key** for `API_KEY`.

`~/.codex/config.toml`:

```toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
model_provider = "magnitude"
model = "magnitude-local/MODEL_ID"

[model_providers.magnitude]
name = "Magnitude"
base_url = "http://ADDRESS:10100/inference/v1/proxies/codex"
wire_api = "responses"
env_key = "MAGNITUDE_API_KEY"
```

Export `MAGNITUDE_API_KEY` with the API key before starting Codex. Codex warns that model metadata is not found and continues. Only local models are available from another device.


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