Integrations

OpenHands

Run the OpenHands coding agent on any MiniRouter model.

OpenHands is an autonomous coding agent with a CLI and a web GUI. Point it at MiniRouter to run it on any tool-capable model in the catalog, with per-key spend limits and guardrails.

1. Install OpenHands

Terminal
uv tool install openhands --python 3.12

On Windows, run these inside WSL.

2. Create a key

Create a key for this agent alone.

3. Set the model

In the GUI, open Settings → LLM and turn on Advanced. In the CLI, run /settings.

Custom Model
openai/zai/glm-5.3-flashThe openai/ prefix selects the OpenAI-compatible driver; everything after it is our model id, unchanged.
Base URL
https://api.minirouter.sh/v1
API Key
mr-live-… (your key)

4. Run a task

Terminal
openhands

Give it one task, then open Activity. Each request lists its model, tokens and exact cost.

Run headless

Headless mode runs one task with no UI. Use it in scripts and CI, or see Automatic code review.

Terminal
export LLM_MODEL=openai/zai/glm-5.3-flash
export LLM_BASE_URL=https://api.minirouter.sh/v1
export LLM_API_KEY=mr-live-YOUR-KEY-HERE
openhands --override-with-envs --headless -t "Add unit tests for utils.py"
--headless
No UI. Needs -t or --file.
-t
The task to run.
--json
Prints one event per line.
--override-with-envs
Uses the LLM_* variables. Not saved.

Use routers and presets

Put any of these in Custom Model or LLM_MODEL.

openai/minirouter/auto:code
A model with reliable tool calling, picked by Auto.
openai/minirouter/fusion
The model and effort Fusion picks from the request.
openai/@preset/your-slug
Your saved models and instructions. See Presets.

Compare tool-capable models on Models.

Contain an autonomous agent

Running several agents? Give each its own key in Keys, so one runaway stops alone.

Troubleshooting

LLM provider not found, or the model id is rejected

The openai/ prefix is doing real work — without it the underlying LiteLLM layer tries to guess a provider from the id and fails. Write openai/ followed by our id exactly: openai/zai/glm-5.3-flash.

404, HTML, or a parse error on every request

Almost always the base URL. Use https://api.minirouter.sh/v1 — the bare host without /v1 also works, but never append /chat/completions to the base URL field; the client adds that path itself.

Error: 400 invalid_request.

Credits gone overnight with nothing to show

An agent in a retry loop spends at machine speed. Set dailyLimitNano on the key the agent uses — one key per agent, so a runaway is contained to that key rather than the whole balance.

Error: 402 insufficient_credits.

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.

Every error code, with its fix: Errors.

Next steps

Esc