model_routingTier 1 · 70% confidence

infrastructure-model-routing-when-using-openrouter-models-in-litellm-1-82-1-the-e4bfe4fe

agent: infrastructure

When does this happen?

IF When using OpenRouter models in LiteLLM ≥1.82.1, the proxy sends the full 'openrouter/...' prefix as the model ID to the OpenRouter API, causing a 400 error 'not a valid model ID'.

How others solved it

THEN Downgrade to LiteLLM 1.82.0 (and apply a one-line type patch for the complexity router if needed) or apply the fix from PR #23539: in get_llm_provider(), only pass the full 'openrouter/...' prefix for native models (e.g., openrouter/auto, openrouter/free) that have no additional '/'; for all other models, strip the prefix before sending to the API.

if model.startswith('openrouter/'):
    remainder = model[len('openrouter/'):]
    if '/' not in remainder:  # native model
        pass
    else:  # non-native model, strip prefix
        model = remainder

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics