---
title: "Codex integration"
description: "Settings for using Codex with minirouter."
canonical_url: "https://minirouter.sh/integrations/codex"
markdown_url: "https://minirouter.sh/integrations/codex.md"
last_updated: "2026-09-13"
---

# Codex + minirouter

Custom Responses API provider configuration for Codex local clients.

Base URL: https://api.minirouter.sh/v1
Get a key: https://minirouter.sh/key

## Settings

~/.codex/config.toml, with MINIROUTER_KEY in the shell environment

1. web_search: disabled
   Hosted web search is not enabled. Local shell and file tools remain available.
2. model_reasoning_summary: none
   The MiniRouter example below does not emit a Codex reasoning summary.
3. model_provider: minirouter
4. model: zai/glm-5.3-flash
5. model_providers.minirouter.base_url: https://api.minirouter.sh/v1
6. model_providers.minirouter.env_key: MINIROUTER_KEY
   Codex reads the MiniRouter key from this environment variable.
7. model_providers.minirouter.wire_api: responses
   Codex uses MiniRouter's /v1/responses endpoint.

## Configuration

~/.codex/config.toml

```
model = "zai/glm-5.3-flash"
model_provider = "minirouter"
web_search = "disabled"
model_reasoning_summary = "none"

[model_providers.minirouter]
name = "MiniRouter"
base_url = "https://api.minirouter.sh/v1"
env_key = "MINIROUTER_KEY"
wire_api = "responses"
```

## Recommended models

Only use a model after confirming it appears in the live model catalog at https://minirouter.sh/api/v1/models.

- zai/glm-5.3-flash: Best current balance of coding ability, agentic performance, context and cost.
- openai/gpt-5.6-sol: Higher-intelligence option when task quality matters more than spend.
- spacexai/grok-4.6: Strong agentic alternative with a 500K-token window.
- google/gemini-3.8-flash: Multimodal coding alternative with a 1M-token window.

## Troubleshooting

### Codex ignores the MiniRouter provider block

Provider and credential redirects are ignored in project-scoped .codex/config.toml files. Put this provider in your user-level ~/.codex/config.toml.

### Codex calls Chat Completions or reports an unsupported wire API

Set wire_api to responses. MiniRouter exposes the Responses route at /v1/responses; Codex appends /responses to the configured base URL.

Error reference: https://minirouter.sh/docs/errors#invalid_request

### 401 on every request

Wrong or rotated key. Keys start with mr-live-; after a rotation the old key keeps working for 24 hours, then dies.

Error reference: https://minirouter.sh/docs/errors#invalid_api_key

### 402 before any tokens arrive

Balance below the estimated cost of the request. Top up (from $0.50 with direct Solana payments) — and watch the x-minirouter-balance-usd header, the low-balance signal every response carries.

Error reference: https://minirouter.sh/docs/errors#insufficient_credits
