Why Use OpenRouter?
- Multiple Models: Access GPT-4, Claude, Gemini, Llama, and dozens of other models
- Single API Key: One key for all models
- Cost Effective: Pay only for what you use
- No Subscriptions: No monthly fees required
- Model Routing: Automatically route to the best available model
Setup Steps
Get Your API Key
- Visit OpenRouter
- Sign up or log in to your account
- Navigate to the API Keys page
- Create a new API key
- Copy your API key (starts with
sk-or-v1-...)
Configure Forge
Run the interactive login command:Select OpenRouter from the list and paste your API key when prompted.
Select a Model
OpenRouter supports many models. Popular choices include:
anthropic/claude-sonnet-4-20250514- Latest Claude Sonnetopenai/gpt-4o- GPT-4 Omnigoogle/gemini-2.5-pro- Gemini Prometa-llama/llama-3.3-70b-instruct- Llama 3.3
forge.yaml:Available Models
OpenRouter provides access to hundreds of models. To see all available models:Configuration
API Endpoint
- Chat Completions:
https://openrouter.ai/api/v1/chat/completions - Models List:
https://openrouter.ai/api/v1/models
Authentication
OpenRouter uses API key authentication via theAuthorization header.
Advanced Features
Model Selection
You can switch between models at any time using the/model command:
Cost Tracking
OpenRouter provides detailed usage and cost information in your dashboard. You can:- Monitor spending in real-time
- Set spending limits
- View usage by model
Troubleshooting
Invalid API Key
If you see an authentication error:- Verify your API key is correct
- Check that the key starts with
sk-or-v1- - Ensure you’ve added credits to your OpenRouter account
Model Not Available
Some models require additional setup or credits:- Check the OpenRouter Models page
- Ensure the model supports the features you need
- Verify you have sufficient credits
Rate Limits
OpenRouter has rate limits that vary by model and plan:- Check your current limits in the dashboard
- Consider upgrading your plan for higher limits
- Implement retry logic for production use
Deprecated: Environment Variable Setup
For backward compatibility, you can still use:Next Steps
- Explore available models
- Learn about cost optimization
- Set up custom providers for additional flexibility