openrouter

openrouter is a skill for Claude Code, Codex from alexdcd/Mafia-Claude-Skills. It costs 18 tokens per session (2,676 once invoked), scanned A, a copy of openrouter, Apache-2.0.

An integration guide for OpenRouter, a service that provides one API for sending requests to AI models from different providers. It covers using compatible software libraries, model selection, routing, fallbacks, streaming, structured responses, and tool calls.

In plain words
What is it for?
Building applications that call several AI model providers, choose or compare models, stream responses, return structured JSON, use tools, or configure automatic routing and provider fallbacks.
Why use it?
It helps an application work with multiple AI models through a common interface instead of implementing each provider separately. It also addresses switching models when one is unavailable and comparing their costs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Building applications that call several AI model providers, choose or compare models, stream responses, return structured JSON, use tools, or configure automatic routing and provider fallbacks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexdcd/mafia-claude-skills/openrouter
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alexdcd/Mafia-Claude-Skills --skill openrouter
Clone the repo
git clone --depth 1 https://github.com/alexdcd/Mafia-Claude-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for openrouter

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexdcd/mafia-claude-skills/openrouter/github.svg)](https://agentmods.dev/skills/alexdcd/mafia-claude-skills/openrouter)
Your own site
<a href="https://agentmods.dev/skills/alexdcd/mafia-claude-skills/openrouter"><img src="https://agentmods.dev/badge/skills/alexdcd/mafia-claude-skills/openrouter/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for openrouter

Your own site · 80×15
<a href="https://agentmods.dev/skills/alexdcd/mafia-claude-skills/openrouter"><img src="https://agentmods.dev/badge/skills/alexdcd/mafia-claude-skills/openrouter.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,676 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.02676
Opus 5 $0.00009 $0.01338
Sonnet 5 $0.00004 $0.00535
Haiku 4.5 $0.00002 $0.00268

Measured 12d ago against content hash 996328dc5f2b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

openrouter scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl https://openrouter.ai/api/v1/chat/completions \
Origin

This is a copy

100% identical to openrouter — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/openrouter/SKILL.md · 320 lines

How it starts

The opening of the file, as written. The whole thing — 320 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenRouter Skill

Comprehensive assistance with OpenRouter API development, providing unified access to hundreds of AI models through a single endpoint with intelligent routing, automatic fallbacks, and standardized interfaces.

When to Use This Skill

This skill should be triggered when:

  • Making API calls to multiple AI model providers through a unified interface
  • Implementing model fallback strategies or auto-routing
  • Working with OpenAI-compatible SDKs but targeting multiple providers
  • Configuring advanced sampling parameters (temperature, top_p, penalties)
  • Setting up streaming responses or structured JSON outputs
  • Comparing costs across different AI models
  • Building applications that need automatic provider failover
  • Implementing function/tool calling across different models
  • Questions about OpenRouter-specific features (routing, fallbacks, zero completion insurance)

Quick Reference

Basic Chat Completion (Python)

from openai import OpenAI

client = OpenAI(
  base_url="https://openrouter.ai/api/v1",
  api_key="<OPENROUTER_API_KEY>",
)

completion = client.chat.completions.create(
  model="openai/gpt-4o",
  messages=[{"role": "user", "content": "What is the meaning of life?"}]
)
print(completion.choices[0].message.content)

Basic Chat Completion (JavaScript/TypeScript)

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://openrouter.ai/api/v1',
  apiKey: '<OPENROUTER_API_KEY>',
});

const completion = await openai.chat.completions.create({
  model: 'openai/gpt-4o',
  messages: [{"role": 'user', "content": 'What is the meaning of life?'}],
});
console.log(completion.choices[0].message);

cURL Request

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "What is the meaning of life?"}]
  }'

Model Fallback Configuration (Python)

completion = client.chat.completions.create(
    model="openai/gpt-4o",
    extra_body={
        "models": ["anthropic/claude-3.5-sonnet", "gryphe/mythomax-l2-13b"],
    },
    messages=[{"role": "user", "content": "Your prompt here"}]
)

Read the full file on GitHub · 320 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 320 lines · 18 tokens per session scan A 996328dc5f2b

Subscribe to this mod's changes

openrouter is a skill published in the GitHub repository alexdcd/Mafia-Claude-Skills (51 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 18 tokens to every session and 2,676 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 100% identical to openrouter, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

google-cloud-solution-guided-gke-ai-migration

Guides the migration of existing AI workloads (Cloud Run, Gemini API, Gemini Enterprise Agent Platform) to self-hosted GKE inference using gcloud and kubectl. Use when the user has an existing AI inference workload (on Cloud Run, the Gemini API, Gemini Enterprise Agent Platform, or a custom VM) and wants to move it to…

google/skills · 157 tokens

agent-platform-tuning

Agent Platform Model Tuning. Use when you need to fine-tune open models or Gemini models using Agent Platform infrastructure. Don't use for model training outside Agent Platform, model deployment to endpoints (use agent-platform-deploy), or managing serving endpoints (use agent-platform-endpoint-management).

google/skills · 64 tokens

agent-platform-prompt-management

Manages and orchestrates prompts in Agent Platform. Use when you need to create, list, retrieve, version, or delete managed prompts in Agent Platform. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform prompts.

google/skills · 55 tokens

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

agent-platform-endpoint-management

Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for running model…

google/skills · 64 tokens

agent-platform-tuning-management

Manages GenAI tuning jobs in Agent Platform. Use this to list, get, or cancel ongoing model tuning jobs. Don't use for fine-tuning models (use agent-platform-tuning), deploying models to endpoints (use agent-platform-deploy), or managing serving endpoints (use agent-platform-endpoint-management).

google/skills · 72 tokens