Models & routing

Models

252 models are listed in the current catalog. Copy the exact ID and use the endpoints supported by that model.

1. Set your API key

Create a key and save the key and recovery link. Replace paste-your-api-key-here with your key, then run this in your terminal.

Set your key
export MINIROUTER_KEY='paste-your-api-key-here'

The example below uses a paid model. Add credits first, or follow the Auto Free guide to send a request without a deposit.

2. Choose a model

Run this command to list models. Copy an id in author/name format from the response.

List models
curl https://api.minirouter.sh/v1/models \
  -H "Authorization: Bearer $MINIROUTER_KEY"

You can also browse models for prices and supported features. Choose a text model for the Chat Completions request below.

3. Send a request

Run this in the same terminal. To use another text model, replace the model value with its exact ID.

Send a text request
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "alibaba/qwen-3-14b",
  "messages": [
    {
      "role": "user",
      "content": "Explain an API gateway in one sentence."
    }
  ],
  "max_tokens": 256
}'

Read the answer in choices[0].message.content and the request cost in usage.cost.

For typed boolean, choice and score questions, see the evaluation API preview.

Next, set request parameters, enable thinking, or request structured output. To receive the answer as it arrives, see streaming.

Let Auto choose a model

Use minirouter/auto as the model value to let MiniRouter choose. The x-minirouter-model header names the model that answered. Paid intents include :smart (the default), :cheap, :code, and :roleplay. See the current choices and how Auto chooses.

For no-deposit requests, use minirouter/auto:free. Check availability and follow the Auto Free guide for its account limits.

Model aliases

Use a shorter name, or pin an exact ID for stable model selection.

Aliases are alternate names listed in a model’s aliases array. Copy a listed alias into the model field, just as you would a model ID.

Use a listed alias
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek/latest",
  "messages": [
    {
      "role": "user",
      "content": "Explain an API gateway in one sentence."
    }
  ],
  "max_tokens": 256
}'

An alias can point to a different model over time, changing its capabilities and price. Use the concrete model ID to keep your requests on the same model. Your key must allow that model.

The response model and x-minirouter-model header identify the model that answered. Activity also records the alias you requested.

Client-compatible catalog

Public model metadata, capabilities, modalities, and pricing.

GET /api/v1/modelsis public. It returns each model’s input and output modalities, capabilities and prices. Models that accept images can answer in text. Models that generate images list their own prices and supported settings.

Catalog shape
{
  "data": [
    {
      "id": "alibaba/qwen-3-14b",
      "name": "Qwen3-14B",
      "context_length": 40960,
      "architecture": {
        "modality": "text->text",
        "input_modalities": [
          "text"
        ],
        "output_modalities": [
          "text"
        ]
      },
      "pricing": {
        "prompt": "0.000000126",
        "completion": "0.000000252",
        "request": "0",
        "image": "0"
      },
      "top_provider": {
        "context_length": 40960,
        "max_completion_tokens": 16384
      },
      "per_request_limits": null
    }
  ]
}

Fallback models

Try an ordered list of models you explicitly allow.

For text requests, send models with an ordered list of acceptable fallback IDs. minirouter never chooses a model outside that list.

Set your key as shown above, then run the example with your preferred models. Do not combine a fallback list with minirouter/auto. See model fallbacks for limits and billing.

Send a request with fallbacks
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "alibaba/qwen-3-14b",
  "models": [
    "alibaba/qwen-3-14b",
    "alibaba/qwen-3-235b"
  ],
  "messages": [
    {
      "role": "user",
      "content": "Explain an API gateway in one sentence."
    }
  ],
  "max_tokens": 256
}'

Send images to a model

Image inputs, supported formats, and request examples.

Image input (vision)

Models that accept images can describe photos, read screenshots, and extract information from charts. Examples include GPT 5.6 Sol, Claude Opus 5, Gemini 2.5 Flash, and GPT 4.1 Mini.

Check architecture.input_modalities in the public catalog for image, and architecture.output_modalities for the response type. Check the exact model ID: variants can have different capabilities. An image input capability does not mean the model generates images.

Send images alongside your prompt using Chat Completions, Responses, or Messages. Use a publicly accessible HTTPS image URL or base64-encoded JPEG, PNG, GIF or WebP. You can include up to 20 images per request, within the request body size limit. Set your API key and add credits as shown above before running these examples.

Image requests can require a larger temporary hold: MiniRouter reserves enough for the model's full input capacity, since an image URL does not reveal its token count. Final billing uses the provider's actual usage and cost.

Chat Completions with images

Run this example, replacing image_url.url with your own image URL. The prompt and image go in the same user message's content array. detail accepts auto, low, or high where supported by the model.

Chat Completions with images
curl --fail-with-body https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "openai/gpt-5.6-sol",
  "max_tokens": 512,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Describe what you see in this image."
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/1024px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
            "detail": "auto"
          }
        }
      ]
    }
  ]
}'

Read the answer in choices[0].message.content. For a local image, use a base64 data URL such as data:image/png;base64,YOUR_BASE64_IMAGE in image_url.url. Set stream: true to stream the text response.

Responses with images

Use input_image content parts on the Responses endpoint. Replace image_url with your HTTPS image URL or base64 data URL.

Responses with images
curl --fail-with-body https://api.minirouter.sh/v1/responses \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "openai/gpt-5.6-sol",
  "store": false,
  "max_output_tokens": 512,
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Describe what you see in this image."
        },
        {
          "type": "input_image",
          "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/1024px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
          "detail": "auto"
        }
      ]
    }
  ]
}'

Read text from output message items' content blocks with type: "output_text". Keep store: false and supply conversation history on each turn. Set stream: true to stream the answer. Tool results can also include input_image parts when their matching tool call is in the supplied history.

Messages with images

Use a type: "image" block alongside your prompt. Replace source.url with your publicly accessible HTTPS image URL.

Messages with images
curl --fail-with-body https://api.minirouter.sh/v1/messages \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  --data '{
  "model": "openai/gpt-5.6-sol",
  "max_tokens": 512,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Describe what you see in this image."
        },
        {
          "type": "image",
          "source": {
            "type": "url",
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/1024px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
          }
        }
      ]
    }
  ]
}'

Read the answer in response content blocks with type: "text". For a local file, replace the image's source object with {"type":"base64","media_type":"image/png","data":"YOUR_BASE64_IMAGE"}. Use raw base64 without a data-URL prefix on this endpoint.

To generate an image or edit an existing image, use the Images API below.

Generate images

Image models, supported settings, and response formats.

Images API

Generate and edit images with GPT Image 2.5 Flare or Sunburst. Their model pages include pricing, supported settings, and generation and editing examples:

Set your API key as shown above and add credits, then run this request to POST /v1/images/generations. It saves the response to response.json and its headers to response.headers.

Images API
curl --fail-with-body --retry 0 --max-time 120 \
  https://api.minirouter.sh/v1/images/generations \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -D response.headers --output response.json \
  --data '{
  "model": "openai/gpt-image-2.5-flare",
  "prompt": "A blue circle on a white background.",
  "quality": "low",
  "size": "1024x1024",
  "output_format": "png",
  "n": 1
}'

After a successful response, decode data[0].b64_json to save the PNG:

Images API
python3 -c 'import base64,json; r=json.load(open("response.json")); open("image.png","wb").write(base64.b64decode(r["data"][0]["b64_json"]))'

For editing, use POST /v1/images/edits with multipart form data and one PNG image. An optional PNG mask must have matching dimensions. Both operations use quality: low, size: 1024x1024, output_format: png, and n: 1. Use a concrete image model ID or one of its listed aliases. Image requests do not use Auto or text-model fallback lists.

A temporary hold reserves twice the estimated cost, including the MiniRouter fee. The final charge cannot exceed that hold. The image response can arrive before billing finishes. Keep x-minirouter-request-id from the response headers and check GET /v1/images/status?request_id=YOUR_REQUEST_ID with the same account before resubmitting an uncertain request. Disable automatic retries.

If you cache image catalog records, refresh them after catalog_expires_at. Video, speech, transcription, embedding, reranking and realtime requests are not supported.

When an ID is wrong

An unavailable ID returns 404 unknown_model with a did-you-mean suggestion and a link to the current list. A real ID this key’s policy excludes returns 403 model_not_allowed.

Esc