Configure Codex
~/.codex/config.toml, with MINIROUTER_KEY in the shell environment
- web_searchdisabled
- model_providerminirouter
- modelzai/glm-5.3-flash
- model_providers.minirouter.base_urlhttps://api.minirouter.sh/v1
- model_providers.minirouter.auth{ command = "sh", args = ["-c", "echo $MINIROUTER_KEY"] }
- model_providers.minirouter.wire_apiresponses
model = "zai/glm-5.3-flash"
model_provider = "minirouter"
web_search = "disabled"
[model_providers.minirouter]
name = "MiniRouter"
base_url = "https://api.minirouter.sh/v1"
wire_api = "responses"
auth = { command = "sh", args = ["-c", "echo $MINIROUTER_KEY"] }Check the connection
Run this after saving. A reply confirms the base URL, key, and model together.
# bash / zsh: enter the full key at the hidden prompt
printf 'MiniRouter API key: '
read -rs MINIROUTER_KEY
export MINIROUTER_KEY
printf '\n'
curl https://api.minirouter.sh/v1/chat/completions \
-H "Authorization: Bearer $MINIROUTER_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"meta/llama-3.3-70b","messages":[{"role":"user","content":"ping"}]}'SDK examples
Calling from code instead? The base URL stays the same.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.MINIROUTER_KEY,
baseURL: "https://api.minirouter.sh",
});
const result = await client.messages.create({
model: "meta/llama-3.3-70b",
max_tokens: 256,
messages: [{ role: "user", content: "ping" }],
});
console.log(result.content);Models and errors
Model IDs are author/name from the model catalog. Failed requests are explained in the error reference.