# Run Codex CLI with open-weight models
URL: https://docs.munito.ai/codex

The Codex CLI runs with open-weight models on Munito AI: add Munito AI as a model provider, and Codex calls the Munito AI Responses API.
Create an [API key](https://console.munito.ai/keys).
Export the key as `MUNITO_API_KEY`:

```bash
export MUNITO_API_KEY=munitoai_...
```

Add this configuration to `~/.codex/config.toml`:

```toml
model = "zai-org/glm-5.3-flash"
model_provider = "munito"

[model_providers.munito]
name = "Munito"
base_url = "https://api.munito.ai/inference/v1"
env_key = "MUNITO_API_KEY"
wire_api = "responses"
```

Run `codex`.
The `wire_api = "responses"` setting connects Codex to the [Munito AI Responses API](https://docs.munito.ai/api/createResponse).
The command `codex exec "<task>"` runs one task without a terminal UI.
All stock Codex tools work: shell commands, file edits and sub-agents.
Munito AI runs no web search, so the model answers without a search.

Use a [regional host](https://docs.munito.ai/regions) to keep processing in the EU or the US.
Replace the `base_url` with the URL for that region:

- EU: `https://api.eu.munito.ai/inference/v1`
- US: `https://api.us.munito.ai/inference/v1`

Change `model` to use another model.
See the [models that your key can use](https://docs.munito.ai/api/listModels).

## Model metadata [#model-metadata]

Codex has no metadata for a Munito AI model.
It prints this warning:

```text
Model metadata for `zai-org/glm-5.3-flash` not found
```

With the fallback, Codex does not know the context window of the model, but the run still works.
The `model_context_window` setting alone does not remove the warning.
Use `model_catalog_json` to supply the metadata and remove the warning.

The command needs `jq`.
It copies one entry of the catalog that ships with Codex and changes the fields for Munito AI.
The catalog file replaces the built-in list.
Run this command before you add `model_catalog_json`:

```bash
codex debug models | jq '{models: [.models[] | select(.slug == "gpt-5.5")
  | .slug = "zai-org/glm-5.3-flash"
  | .display_name = "GLM-5.3 Flash"
  | .description = "GLM-5.3 Flash on Munito"
  | .context_window = 1048576
  | .max_context_window = 1048576
  | .supports_search_tool = false
  | .support_verbosity = false
  | .upgrade = null
  | .service_tiers = []
  | .additional_speed_tiers = []
  | del(.apply_patch_tool_type, .default_verbosity)]}' > ~/.codex/munito-models.json
```

GLM-5.3 Flash has a context window of 1,048,576 tokens.
The other changes disable request features that Munito AI does not accept: the tool search tool, the freeform patch tool and the verbosity setting.

Add this top-level key to `config.toml`, above `[model_providers.munito]`:

```toml
model_catalog_json = "/Users/you/.codex/munito-models.json"
```

Use the absolute path of your home directory in place of `/Users/you`.
The catalog then lists only the models in that file.

## Reasoning effort [#reasoning-effort]

Set `model_reasoning_effort = "high"` at the top of `config.toml`, above `[model_providers.munito]`.
Use `codex -c model_reasoning_effort="high"` for a command-line override.
Codex sends `minimal`, `low`, `medium`, `high` or `xhigh`.
Each model declares its own levels.
Munito AI moves any other level to the nearest declared level, and to the lower level on a tie.

| Model                                  | Declared levels                 | Codex level: level that runs                                          |
| -------------------------------------- | ------------------------------- | --------------------------------------------------------------------- |
| `zai-org/glm-5.3-flash`                | `low`, `high`, `max`            | `minimal`, `low`, `medium`: `low`. `high`, `xhigh`: `high`            |
| `deepseek-ai/deepseek-v4-flash`        | `low`, `high`, `max`            | `minimal`, `low`, `medium`: `low`. `high`, `xhigh`: `high`            |
| `deepseek-ai/deepseek-v4.1-flash-1017` | `low`, `high`, `max`            | `minimal`, `low`, `medium`: `low`. `high`, `xhigh`: `high`            |
| `qwen/qwen3.8-27b`                     | `low`, `medium`, `xhigh`        | `minimal`, `low`: `low`. `medium`, `high`: `medium`. `xhigh`: `xhigh` |
| `aleph-alpha/kolibri-1`                | `none`, `low`, `medium`, `high` | `minimal`, `low`: `low`. `medium`: `medium`. `high`, `xhigh`: `high`  |

Codex cannot send `max`.
