OpenRouter — Unified LLM API Gateway
You are an expert in OpenRouter, the unified API gateway for accessing 200+ LLMs through a single OpenAI-compatible endpoint. You help developers route requests to GPT-4o, Claude, Gemini, Llama, Mistral, and other models with automatic fallbacks, cost tracking, rate limiting, and model comparison — enabling multi-model strategies without managing multiple API keys and SDKs.
Best use case
OpenRouter — Unified LLM API Gateway is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
You are an expert in OpenRouter, the unified API gateway for accessing 200+ LLMs through a single OpenAI-compatible endpoint. You help developers route requests to GPT-4o, Claude, Gemini, Llama, Mistral, and other models with automatic fallbacks, cost tracking, rate limiting, and model comparison — enabling multi-model strategies without managing multiple API keys and SDKs.
Teams using OpenRouter — Unified LLM API Gateway should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/openrouter/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How OpenRouter — Unified LLM API Gateway Compares
| Feature / Agent | OpenRouter — Unified LLM API Gateway | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
You are an expert in OpenRouter, the unified API gateway for accessing 200+ LLMs through a single OpenAI-compatible endpoint. You help developers route requests to GPT-4o, Claude, Gemini, Llama, Mistral, and other models with automatic fallbacks, cost tracking, rate limiting, and model comparison — enabling multi-model strategies without managing multiple API keys and SDKs.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# OpenRouter — Unified LLM API Gateway
You are an expert in OpenRouter, the unified API gateway for accessing 200+ LLMs through a single OpenAI-compatible endpoint. You help developers route requests to GPT-4o, Claude, Gemini, Llama, Mistral, and other models with automatic fallbacks, cost tracking, rate limiting, and model comparison — enabling multi-model strategies without managing multiple API keys and SDKs.
## Core Capabilities
### OpenAI-Compatible API
```typescript
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://openrouter.ai/api/v1",
apiKey: process.env.OPENROUTER_API_KEY,
defaultHeaders: {
"HTTP-Referer": "https://myapp.com", // Required for ranking
"X-Title": "My App", // Shows in OpenRouter dashboard
},
});
// Use any model with OpenAI SDK
const response = await openai.chat.completions.create({
model: "anthropic/claude-sonnet-4-20250514", // Or: "openai/gpt-4o", "google/gemini-2.0-flash"
messages: [{ role: "user", content: "Hello!" }],
});
// Streaming
const stream = await openai.chat.completions.create({
model: "openai/gpt-4o",
messages: [{ role: "user", content: "Write a poem" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}
// Auto-routing: let OpenRouter pick the best model
const autoResponse = await openai.chat.completions.create({
model: "openrouter/auto", // Routes to best model for the task
messages: [{ role: "user", content: "Complex reasoning task..." }],
});
// Cost-optimized routing
const cheapResponse = await openai.chat.completions.create({
model: "openrouter/auto",
route: "fallback", // Try cheapest first, fall back to better
models: ["openai/gpt-4o-mini", "anthropic/claude-sonnet-4-20250514", "openai/gpt-4o"],
messages: [{ role: "user", content: "Simple task" }],
});
```
### Model Comparison
```typescript
// Compare models side-by-side
const models = [
"openai/gpt-4o",
"anthropic/claude-sonnet-4-20250514",
"google/gemini-2.0-flash",
"meta-llama/llama-3.1-70b-instruct",
];
const results = await Promise.all(
models.map(async (model) => {
const start = Date.now();
const response = await openai.chat.completions.create({
model,
messages: [{ role: "user", content: testPrompt }],
max_tokens: 500,
});
return {
model,
latency: Date.now() - start,
tokens: response.usage,
cost: response.usage?.total_tokens, // OpenRouter returns cost info
output: response.choices[0].message.content,
};
}),
);
```
### With Vercel AI SDK
```typescript
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
import { generateText } from "ai";
const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
const { text } = await generateText({
model: openrouter("anthropic/claude-sonnet-4-20250514"),
prompt: "Explain quantum computing",
});
```
## Installation
```bash
npm install openai # Use OpenAI SDK
# Or: npm install @openrouter/ai-sdk-provider # For Vercel AI SDK
```
## Best Practices
1. **One API, all models** — Single API key for GPT-4o, Claude, Gemini, Llama, Mistral; no vendor lock-in
2. **Fallback routing** — Configure model fallbacks; if primary is down or overloaded, auto-switch to backup
3. **Cost tracking** — OpenRouter dashboard shows per-model costs; optimize spend by routing simple tasks to cheap models
4. **OpenAI SDK compatible** — Just change `baseURL` and `apiKey`; all OpenAI SDK features work (tools, streaming, JSON mode)
5. **Free models** — Some models available for free (rate-limited); great for prototyping
6. **Auto routing** — Use `openrouter/auto` to let the system pick the best model based on task complexity
7. **Provider preferences** — Set model priorities and fallbacks; optimize for cost, speed, or quality
8. **Usage limits** — Set per-key spending limits in dashboard; prevent runaway costs in productionRelated Skills
building-api-gateway
Create API gateways with routing, load balancing, rate limiting, and authentication. Use when routing and managing multiple API services. Trigger with phrases like "build API gateway", "create API router", or "setup API gateway".
api-gateway-config
Api Gateway Config - Auto-activating skill for AWS Skills. Triggers on: api gateway config, api gateway config Part of the AWS Skills skill category.
azure-aigateway
Configure Azure API Management (APIM) as AI Gateway to secure, observe, control AI models, MCP servers, agents. Helps with rate limiting, semantic caching, content safety, load balancing. USE FOR: AI Gateway, APIM, setup gateway, configure gateway, add gateway, model gateway, MCP server, rate limit, token limit, semantic cache, content safety, load balance, OpenAPI import, convert API to MCP. DO NOT USE FOR: deploy models (use microsoft-foundry), Azure Functions (use azure-functions), databases (use azure-postgres).
Portkey — AI Gateway for Production LLM Apps
You are an expert in Portkey, the AI gateway that sits between your app and LLM providers. You help developers add caching, fallbacks, load balancing, request retries, guardrails, semantic caching, budget limits, and observability to LLM calls — using a single unified API that works with 200+ models from OpenAI, Anthropic, Google, and open-source providers.
HuggingFace Accelerate - Unified Distributed Training
## Quick start
Azure VPN Gateway Skill
This skill provides expert guidance for Azure VPN Gateway. Covers troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations & coding patterns, and deployment. It combines local quick-reference content with remote documentation fetching capabilities.
Azure NAT Gateway Skill
This skill provides expert guidance for Azure NAT Gateway. Covers troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, configuration, and deployment. It combines local quick-reference content with remote documentation fetching capabilities.
Azure Application Gateway Skill
This skill provides expert guidance for Azure Application Gateway. Covers troubleshooting, best practices, decision making, limits & quotas, security, configuration, integrations & coding patterns, and deployment. It combines local quick-reference content with remote documentation fetching capabilities.
API Gateway
Passthrough proxy for direct access to third-party APIs using managed OAuth connections, provided by [Maton](https://maton.ai). The API gateway lets you call native API endpoints directly.
openrouter-automation
Automate Openrouter tasks via Rube MCP (Composio). Always search tools first for current schemas.
Daily Logs
Record the user's daily activities, progress, decisions, and learnings in a structured, chronological format.
Socratic Method: The Dialectic Engine
This skill transforms Claude into a Socratic agent — a cognitive partner who guides