OpenRouter Integration
Use your own AI models through OpenRouter API.
Overview
OpenRouter provides access to multiple AI models through a single API:
- Claude (Anthropic)
- GPT-4, GPT-5 (OpenAI)
- Gemini (Google)
- Llama (Meta)
- And many more
Setup
1. Get OpenRouter API Key
- Go to OpenRouter
- Sign up or log in
- Navigate to API Keys
- Create a new key
2. Add to Your Project
In Prompt To App:
- Click Extensions → OpenRouter
- Enter your API key
- Select models to use
Use Cases
Custom AI Features
"Add a chatbot that uses GPT-4 to answer customer questions"
AI generates:
- Chat interface component
- OpenRouter API integration
- Message history management
- Streaming response handling
Content Generation
"Create a blog post generator using Claude Sonnet"
AI generates:
- Input form for topic/keywords
- OpenRouter API call
- Markdown rendering
- Export functionality
Example Implementation
const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'anthropic/claude-3.5-sonnet',
messages: [
{ role: 'user', content: 'Hello!' }
],
}),
});
const data = await response.json();
console.log(data.choices[0].message.content);
Available Models
anthropic/claude-3.5-sonnetopenai/gpt-4-turbogoogle/gemini-prometa-llama/llama-3-70b
See OpenRouter Models for full list.