# minirouter agent onboarding

You are configuring minirouter, an OpenAI-compatible LLM gateway. The
human-readable setup page is https://minirouter.sh/setup. The full onboarding
guide, with key safety and spend controls, is
https://minirouter.sh/docs/guides/agent-onboarding.md

## Connection

- Base URL: https://api.minirouter.sh/v1
- API key environment variable: MINIROUTER_KEY
- Key format: mr-live-<26 base58>
- Model IDs: author/name, for example meta/llama-3.3-70b
- Model list: GET https://api.minirouter.sh/v1/models

Both https://api.minirouter.sh/v1 and https://api.minirouter.sh are accepted as base URLs. Do
not append /chat/completions in a client's base URL field; clients add the
endpoint themselves.

## Get a key

Check MINIROUTER_KEY in the environment. If it is absent, send the human to
https://minirouter.sh/key. No account is required, and the key is created
before payment. Save the API key and permanent dashboard link shown during
setup; the link preserves dashboard access if the key is lost or rotated.
Email or wallet sign-in at https://minirouter.sh/start adds personal recovery.

An agent with its own Solana wallet can create and fund an account itself:
https://minirouter.sh/docs/agent-payments.md

## Verify the connection

    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"}]}'

## Configure a client

Use the client guide for its base URL, key and model fields:
https://minirouter.sh/setup

Do not invent model IDs or shorten them. Fetch the current catalog when the
requested model is not known. If no model was specified, "minirouter/auto" is
a valid choice: the gateway picks one and reports it in x-minirouter-model.

## Images, audio, video and decisions

These use the same key and base URL, but not /chat/completions.

- Images: POST https://api.minirouter.sh/v1/images/generations with a type image model.
  Guide: https://minirouter.sh/docs/models.md
- Audio: POST https://api.minirouter.sh/v1/audio/speech or https://api.minirouter.sh/v1/audio/transcriptions with
  a type speech or transcription model. Guide: https://minirouter.sh/docs/audio.md
- Video: POST https://api.minirouter.sh/v1/videos with a type video model, poll
  GET https://api.minirouter.sh/v1/videos/{id}, then download GET https://api.minirouter.sh/v1/videos/{id}/content
  within 24 hours of completion. Jobs are asynchronous. If a create fails with
  video_request_failed, poll its x-minirouter-request-id before creating
  another. Guide: https://minirouter.sh/docs/videos.md
- Decisions: POST https://api.minirouter.sh/v1/decisions or https://api.minirouter.sh/v1/evaluate, whichever the
  model supports, to ask typed questions and get probabilities, choices and
  scores. Find type evaluation models in the public list at
  https://minirouter.sh/api/v1/models. Turn off client retries.
  Guide: https://minirouter.sh/docs/evaluations.md

## Recovery

- 401 invalid_api_key: check or rotate the key.
- 402 insufficient_credits: ask the human to top up, or pay from your own wallet (https://minirouter.sh/docs/agent-payments.md).
- 404 unknown_model: use the suggestion or fetch the model list.
- 429 rate_limited: wait for Retry-After before retrying.
- 503 upstream_capacity_exceeded: the provider is at capacity; wait before retrying or choose another allowed model.
- 503 upstream_rate_limited: the upstream provider is rate limiting; raising your MiniRouter key limit will not help.
- 503 no_available_route: check model availability and your account, key and request provider restrictions.
- 503 model_unavailable: the provider could not complete the request; check status or choose another allowed model.
- 504 request_timeout: follow the timeout advice; partial output must not be blindly replayed.
- Include error.request_id or x-minirouter-request-id when requesting support.

Full error reference: https://minirouter.sh/docs/errors.md

## Routing and cost

- Failover between hosts of the same model is automatic.
- To allow fallback to another model, send models as an ordered list of
  acceptable model IDs. minirouter never chooses outside that list.
- Response headers include x-minirouter-provider, x-minirouter-ttft-ms,
  x-minirouter-cost-usd and x-minirouter-balance-usd.
- 1,000 credits = $1.

## Documentation retrieval

- Index: https://minirouter.sh/llms.txt
- Full corpus: https://minirouter.sh/llms-full.txt
- Agent resources: https://minirouter.sh/docs/agent-resources.md
- Documentation MCP server: https://minirouter.sh/mcp
- Append .md to a docs or integration URL for clean Markdown.
- The same pages negotiate Markdown with Accept: text/markdown.
