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

# Codex

> Route OpenAI Codex through the Inference.net gateway with inf codex.

`inf codex` routes Codex through `https://api.inference.net/v1` using the OpenAI Responses surface. Codex resolves provider credentials through an env var name, so the key lives in `$CODEX_HOME/.env`, not inline in the config.

## Config files

`inf` writes fields in `~/.codex/config.toml` (TOML) and `$CODEX_HOME/.env`. Both honor `CODEX_HOME`. `inf` owns fields in both files, not the whole files.

## `inf codex on`

<Metadata text="cli/coding-agents/codex/on-default[series=coding_agents_codex]" />

```bash theme={"system"}
inf codex on
```

| Flag              | Required | Description                             | Default        |
| ----------------- | -------- | --------------------------------------- | -------------- |
| `--model <alias>` | No       | Model alias written as the root `model` | `kimi-k3-fast` |

See [Model mapping](/cli/coding-agents#model-mapping) for supported aliases and limits.

## What gets written

TOML owned fields in `config.toml`:

| Path                                   | Value                          |
| -------------------------------------- | ------------------------------ |
| `model`                                | selected alias                 |
| `model_provider`                       | `inference`                    |
| `[model_providers.inference].name`     | `Inference.net`                |
| `[model_providers.inference].base_url` | `https://api.inference.net/v1` |
| `[model_providers.inference].env_key`  | `INFERENCE_API_KEY`            |
| `[model_providers.inference].wire_api` | `responses`                    |

`.env` owned line:

| Path                | Value                |
| ------------------- | -------------------- |
| `INFERENCE_API_KEY` | gateway key (secret) |

<Metadata text="cli/coding-agents/codex/provider-toml" />

```toml theme={"system"}
model = "kimi-k3-fast"
model_provider = "inference"

[model_providers.inference]
name = "Inference.net"
base_url = "https://api.inference.net/v1"
env_key = "INFERENCE_API_KEY"
wire_api = "responses"
```

## `inf codex status`

<Metadata text="cli/coding-agents/codex/status[series=coding_agents_codex]" />

```bash theme={"system"}
inf codex status
```

## `inf codex off`

<Metadata text="cli/coding-agents/codex/off[series=coding_agents_codex]" />

```bash theme={"system"}
inf codex off
```

`off` restores unchanged owned fields. It keeps fields that you edited after `on`.

## Examples

Select the Fast-tier alias:

<Metadata text="cli/coding-agents/codex/on-model[series=coding_agents_codex]" />

```bash theme={"system"}
inf codex on --model glm-5.2-fast
```

Restart Codex after `on` or `off`. See [Troubleshooting](/cli/coding-agents/troubleshooting) for drift, recovery, and key revocation.
