Integrations
LiteLLM
Reach every MiniRouter model from the LiteLLM SDK or proxy.
LiteLLM is a Python SDK and proxy with one OpenAI-style interface. Add MiniRouter once and every app behind it reaches the catalog, routers and your presets, on one balance.
1. Install the proxy
pip install 'litellm[proxy]'uv tool install 'litellm[proxy]'2. Export your key
Create a key, then export it where the proxy runs.
export MINIROUTER_API_KEY=mr-live-YOUR-KEY-HEREsetx MINIROUTER_API_KEY mr-live-YOUR-KEY-HERE3. Add a model
model_list:
- model_name: glm-5.3-flash
litellm_params:
model: openai/zai/glm-5.3-flash
api_base: https://api.minirouter.sh/v1
api_key: os.environ/MINIROUTER_API_KEYClients of the proxy call the model_name. litellm_params.model is what MiniRouter receives.
4. Start and verify
litellm --config config.yamlcurl http://0.0.0.0:4000/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3-flash","messages":[{"role":"user","content":"Hello"}]}'Open Activity. The request lists its model, tokens and exact cost.
Call from the Python SDK
No proxy needed. Pass the base URL and key on each call.
import os
from litellm import completion
response = completion(
model="openai/zai/glm-5.3-flash",
api_base="https://api.minirouter.sh/v1",
api_key=os.environ["MINIROUTER_API_KEY"],
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)Add routers and presets
Each entry becomes one model_name for proxy clients.
model_list:
- model_name: auto-code
litellm_params:
model: openai/minirouter/auto:code
api_base: https://api.minirouter.sh/v1
api_key: os.environ/MINIROUTER_API_KEY
- model_name: my-preset
litellm_params:
model: openai/@preset/your-slug
api_base: https://api.minirouter.sh/v1
api_key: os.environ/MINIROUTER_API_KEYKeep spend in check
Restrict models or filter content with Guardrails.
Recommended modelsBrowse every model in the catalog.
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
404 from the gateway
Set api_base to https://api.minirouter.sh/v1 exactly. LiteLLM's OpenAI transport does not add /v1 for a custom api_base, so include it yourself and nothing after it.
Error: 400 invalid_request.
Cost tracking shows $0 for every request
LiteLLM prices from its own model table, which does not list our ids. Billing on our side is unaffected; read the x-minirouter-balance-usd header for the truth.
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: 401 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: 402 insufficient_credits.
Every error code, with its fix: Errors.