Configure OpenClaw
~/.openclaw/openclaw.json
- models.providers.minirouter.baseUrlhttps://api.minirouter.sh/v1
- models.providers.minirouter.apiopenai-completions
- models.providers.minirouter.apiKey${MINIROUTER_KEY}
- agents.defaults.model.primaryminirouter/zai/glm-5.3-flash
{
agents: {
defaults: {
model: { primary: "minirouter/zai/glm-5.3-flash" }
}
},
models: {
providers: {
minirouter: {
baseUrl: "https://api.minirouter.sh/v1",
apiKey: "${MINIROUTER_KEY}",
api: "openai-completions",
timeoutSeconds: 300,
// cost is OpenClaw's own accounting field, in USD per million
// tokens. Copy the current rates for each model you add from
// https://minirouter.sh/models rather than leaving these stale.
models: [
{
id: "zai/glm-5.3-flash",
name: "GLM 5.3 Flash (minirouter)",
reasoning: true,
input: ["text", "image"],
cost: { input: 0.1575, output: 0.525 },
contextWindow: 1000000,
maxTokens: 131000
}
]
}
}
}
}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 { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const minirouter = createOpenAICompatible({
name: "minirouter",
apiKey: process.env.MINIROUTER_KEY,
baseURL: "https://api.minirouter.sh/v1",
});
const { text } = await generateText({
model: minirouter("meta/llama-3.3-70b"),
prompt: "ping",
});
console.log(text);Models and errors
Model IDs are author/name from the model catalog. Failed requests are explained in the error reference.