Quickstart examples for OpenRouter's unified LLM API. This shows basic usage and streaming for applications that need redundancy across multiple AI providers.
OpenRouter gives access to hundreds of AI models from various providers through their API. It's built for applications where redundancy and provider diversity are the core requirements. If one provider goes down then it is possible to switch to another easily.
main.py- Basic API usage (non-streaming)streaming_demo.py- Real-time streaming demonPipfile- Python dependencies
- Install:
pipenv install - Set API Key: Replace the key in both Python files with yours from OpenRouter
- Run:
pipenv run python main.py # Basic usage pipenv run python streaming_demo.py # Streaming