Quickstart
Get started with OpenRouter
OpenRouter provides a unified API that gives you access to hundreds of AI models through a single endpoint, while automatically handling fallbacks and selecting the most cost-effective options. Get started with just a few lines of code using your preferred SDK or framework.
Want to chat with our docs? Download an LLM-friendly text file of our full documentation and include it in your system prompt.
In the examples below, the OpenRouter-specific headers are optional. Setting them allows your app to appear on the OpenRouter leaderboards.
Using the OpenAI SDK
Using the OpenRouter API directly
The API also supports streaming.
Using third-party SDKs
For information about using third-party SDKs and frameworks with OpenRouter, please see our frameworks documentation.