Quickstart
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.
Looking for information about free models and rate limits? Please see the FAQ
In the examples below, the OpenRouter-specific headers are optional. Setting them allows your app to appear on the OpenRouter leaderboards. For detailed information about app attribution, see our App Attribution guide.
First, install the SDK:
Then use it in your code:
You can use the interactive Request Builder to generate OpenRouter API requests in the language of your choice.
The API also supports streaming.
For information about using third-party SDKs and frameworks with OpenRouter, please see our frameworks documentation.