Build AI Agents with OpenRouter
Unified API gateway providing access to 100+ models from all major providers through one endpoint.
Available OpenRouter Models
| Model | ID |
|---|---|
| GPT-4o (via OpenRouter) | openai/gpt-4o |
| Claude 3.5 Sonnet (via OpenRouter) | anthropic/claude-3.5-sonnet |
| Gemini 2.0 Flash (via OpenRouter) | google/gemini-2.0-flash |
Why use OpenRouter for AI agents?
100+ models
Single API key
Automatic fallbacks
Usage-based billing
Best use cases
- Multi-model workflows
- Provider flexibility
- A/B testing models
- Fallback strategies
Quick start code
agent.py
from agno.agent import Agent
from agno.models.openrouter import OpenRouter
agent = Agent(
name="My OpenRouter Agent",
model=OpenRouter(id="openai/gpt-4o"),
instructions=["You are a helpful assistant."],
markdown=True,
)
agent.print_response("Hello! What can you help me with?")Install: pip install agno Then set OPENROUTER_API_KEY