LiteLLM

Route LiteLLM client calls and proxy models through AnyRouter as a custom OpenAI-compatible provider.

LiteLLM reaches AnyRouter as a custom OpenAI-compatible provider. Prefix the model with openai/, set api_base to https://anyrouter.dev/api/v1, and pass an sk-ar- key from the dashboard. The part after openai/ is the AnyRouter model id.

import litellm

response = litellm.completion(
    model="openai/google/gemini-3.5-flash",
    api_base="https://anyrouter.dev/api/v1",
    api_key="your-anyrouter-api-key",
    messages=[{"role": "user", "content": "Explain load balancing."}],
)
print(response.choices[0].message.content)

A model reply confirms it works.

Troubleshooting

SymptomFix
401api_key (or ANYROUTER_API_KEY) must start with sk-ar-.
404 model not foundAfter openai/, use a full provider/model id from the catalog.

AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer