openrouter
Skill by alexdcd
OpenRouter gives an AI assistant guidance for the OpenRouter API, which provides unified access to 400+ AI models through one endpoint. It covers chat completions, model fallbacks, auto routing and sampling settings. It suits developers who call several model providers from one codebase.
Install openrouter
Built from the published package, never by AI.
git clone --depth 1 https://github.com/alexdcd/Mafia-Claude-Skills /tmp/Mafia-Claude-Skills && mkdir -p ~/.claude/skills && cp -r /tmp/Mafia-Claude-Skills/skills/openrouter ~/.claude/skills/openrouterRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/alexdcd/Mafia-Claude-Skills /tmp/Mafia-Claude-Skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/Mafia-Claude-Skills/skills/openrouter ~/.gemini/antigravity-cli/skills/openrouterAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a working reference for building with the OpenRouter API. OpenRouter provides access to hundreds of AI models through a single endpoint at https://openrouter.ai/api/v1. The skill includes chat completion examples in Python, JavaScript and cURL, using OpenAI-compatible SDKs with a changed base URL. It also covers model fallback arrays, the openrouter/auto router, sampling parameters, streaming, JSON mode and seed settings.
The skill is aimed at developers who target several model providers and want automatic fallbacks or provider failover. It points to reference files that list available models and links to the official OpenRouter documentation. The source notes that pricing depends on the model actually used, which matters when a fallback runs. Beginners can start with basic chat requests, while advanced users can tune routing and parameters.
Written from the project's SKILL.md and checked against it.
What it can do
- Chat completionsSends chat requests to many models through one OpenRouter endpoint.
- Model fallbacksPasses a list of backup models that are tried if the primary model fails.
- Auto routerUses openrouter/auto to pick a model based on the prompt.
- Sampling controlsSets temperature, top_p, max tokens and presence or frequency penalties.
- Streaming responsesStreams model output through Server-Sent Events.
- JSON modeRequests structured JSON output using response_format.
- Seed parameterSets a seed to aim for reproducible output where the model supports it.
- Tool callingConnects models to external functions and APIs across providers.
What you need
- OpenRouter API key
- OpenAI-compatible SDK or cURL for sending requests
Try asking
- Call openai/gpt-4o through OpenRouter with a Claude 3.5 Sonnet fallback.
- Stream a story from a model using OpenRouter with stream enabled.
- Use openrouter/auto to pick a model for my prompt and explain the choice.
Good to know
- Seed-based determinism only applies when the model supports it.
- Max tokens cannot exceed the context length minus the prompt length.
- Pricing is based on the model that actually processed the request.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/openrouter/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to openrouter
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
openrouter: common questions
Does this need an OpenRouter API key?
Yes. Requests use Bearer token authentication, and the examples read the key from OPENROUTER_API_KEY.
How do model fallbacks work with OpenRouter?
You pass a models array with backup models through extra_body. The source says the request retries on the listed models if the primary model fails.
Can I use the OpenAI SDK with OpenRouter?
Yes. The source says OpenRouter uses an OpenAI-compatible API format, and the examples set base_url to the OpenRouter endpoint.
How do I install openrouter?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is openrouter free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is openrouter safe to use?
It scores 77 of 100. Grades: maintenance A, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to openrouter?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
