Skip to content

OpenRouter

Overview

OpenRouter — model aggregator: one API key for access to dozens of LLM from different developers.

Features

  • access to OpenAI, Anthropic, Mistral, and others through a single API;
  • model selection by price and quality;
  • OpenAI-compatible interface;
  • usage analytics.

Use Cases

  • testing different models;
  • replacing multiple APIs with one;
  • finding the best model for a task.

Example

from openai import OpenAI

client = OpenAI(
    api_key="OPENROUTER_KEY",
    base_url="https://openrouter.ai/api/v1",
)

response = client.chat.completions.create(
    model="deepseek/deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}],
)

See Also