Configure Claude Code
Shell environment, or env in ~/.claude/settings.json
- ANTHROPIC_BASE_URLhttps://api.minirouter.sh
- ANTHROPIC_AUTH_TOKEN$MINIROUTER_KEY
- ANTHROPIC_MODELzai/glm-5.3-flash
- CLAUDE_CODE_MAX_CONTEXT_TOKENS1000000
export MINIROUTER_KEY=mr-live-YOUR-KEY-HERE
export ANTHROPIC_BASE_URL=https://api.minirouter.sh
export ANTHROPIC_AUTH_TOKEN="$MINIROUTER_KEY"
export ANTHROPIC_MODEL="zai/glm-5.3-flash"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000
claude --model "$ANTHROPIC_MODEL"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 OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MINIROUTER_KEY,
baseURL: "https://api.minirouter.sh/v1",
});
const result = await client.chat.completions.create({
model: "meta/llama-3.3-70b",
messages: [{ role: "user", content: "ping" }],
});
console.log(result.choices[0]?.message.content);Models and errors
Model IDs are author/name from the model catalog. Failed requests are explained in the error reference.