---
title: "LiteLLM integration"
description: "Settings for using LiteLLM with minirouter."
canonical_url: "https://minirouter.sh/integrations/litellm"
markdown_url: "https://minirouter.sh/integrations/litellm.md"
last_updated: "2026-09-13"
---

# LiteLLM + minirouter

Configuration for the LiteLLM SDK and proxy: one `openai/`-prefixed model string or one proxy YAML entry reaches every minirouter model.

Base URL: https://api.minirouter.sh/v1
Get a key: https://minirouter.sh/key

## Settings

Python SDK call, or config.yaml for the proxy

1. model: openai/zai/glm-5.3-flash
   The openai/ prefix selects LiteLLM's OpenAI-compatible transport; everything after it is our model id. Once the upstream provider PR lands this becomes minirouter/zai/glm-5.3-flash with no api_base.
2. api_base: https://api.minirouter.sh/v1
3. api_key: mr-live-… (your key)

## Configuration

config.yaml for the proxy

```
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_KEY
```

## Recommended models

Only use a model after confirming it appears in the live model catalog at https://minirouter.sh/api/v1/models.

- 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

### LiteLLM appends /v1 twice or reports a 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 reference: https://minirouter.sh/docs/errors#invalid_request

### Cost tracking shows $0 for every request

LiteLLM prices from its own model table, which does not know our ids until the upstream pricing PR lands. 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 reference: https://minirouter.sh/docs/errors#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 reference: https://minirouter.sh/docs/errors#insufficient_credits
