openrouter
Official Python Client SDK for OpenRouter.
Decision gist · record as of 2026-08-14
Yes. The SDK is actively maintained, has no known vulnerabilities, low install friction, and is the official client for OpenRouter's multi-provider API. It's worth installing if you need to access multiple AI models through a single, type-safe interface or want to avoid vendor lock-in. The Apache-2.0 license is permissive for commercial use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher; an OpenRouter API key must be set via the OPENROUTER_API_KEY environment variable.
- Low install friction with a pure-Python wheel distribution and four lightweight runtime dependencies.
- The package is actively maintained with a recent release and no known vulnerabilities.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-08-14 (0 days) · last repo commit 2026-08-14 · 147 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,865,574 downloads/mo, #3,481 on PyPI
Alternatives
Verify before relying
pip install openrouter
from openrouter import OpenRouter
import os
with OpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) as client:
res = client.chat.send(
model="anthropic/claude-4.5-sonnet",
messages=[{"role": "user", "content": "Hello"}]
)
print(res)- Whether the SDK's type safety is enforced at runtime or only for IDE/static analysis purposes.
- Performance characteristics and rate-limiting behavior when routing across multiple providers.
- Specific error handling and retry strategies for provider-side failures.
What it is and what it does
OpenRouter is the official Python SDK for accessing the OpenRouter API, which abstracts away the differences between multiple AI model providers (such as Anthropic, OpenAI, and others) under a unified interface. The SDK provides type-safe request construction using Pydantic, supports both blocking and async/await patterns, and handles streaming responses. It includes built-in support for OpenRouter-specific features like web search integration and provider selection strategies (e.g., sorting by price or using zero-downtime routing).
The package is designed for developers building AI-powered applications who want to avoid vendor lock-in by easily switching between providers or load-balancing across them. It handles the HTTP transport layer via httpx and httpcore, parses JSON responses with jsonpath-python, and validates all request and response shapes through Pydantic models. The SDK is marked as stable as of v1.0 and follows a Python version support policy with a grace period after official end-of-life.
Use it for
- Build a chatbot that can route requests to the cheapest available model provider in real time.
- Integrate web search capabilities into an AI assistant using OpenRouter's server-side search tool.
- Create a multi-provider LLM application without rewriting code when switching from Claude to GPT-4.
- Stream long-form AI responses to a web client using the SDK's native streaming support.
- Implement pagination over model or provider listings using the SDK's built-in pagination helpers.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The SDK is actively maintained, has no known vulnerabilities, low install friction, and is the official client for OpenRouter's multi-provider API. It's worth installing if you need to access multiple AI models through a single, type-safe interface or want to avoid vendor lock-in. The Apache-2.0 license is permissive for commercial use.
Install
openrouter on PyPI
Before you install
Low install friction with a pure-Python wheel distribution and four lightweight runtime dependencies. The package is actively maintained with a recent release and no known vulnerabilities.
Requires Python 3.10 or higher; an OpenRouter API key must be set via the OPENROUTER_API_KEY environment variable.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install openrouter
from openrouter import OpenRouter
import os
with OpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) as client:
res = client.chat.send(
model="anthropic/claude-4.5-sonnet",
messages=[{"role": "user", "content": "Hello"}]
)
print(res)
Verify before relying
- Whether the SDK's type safety is enforced at runtime or only for IDE/static analysis purposes.
- Performance characteristics and rate-limiting behavior when routing across multiple providers.
- Specific error handling and retry strategies for provider-side failures.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packageshttpcorehttpxjsonpath-pythonpydantic |
| Maintenance | Actively maintained 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,865,574 / month, #3,481 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: openrouter-1.1.55-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “openrouter python sdk”
- openrouterA Python SDK for accessing 400+ AI models across multiple providers…
- langchain-openrouterConnects LangChain applications to OpenRouter, a unified API gateway…
- mini-swe-agentAn AI agent that solves software engineering tasks by running bash…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also langchain-openrouter · orq-ai-sdk · any-llm-sdk · jigsawstack · mistralai · sap-ai-sdk-gen · generative-ai-hub-sdk · openai-chatkit · agent-framework-openai