From anyrouter
Wire AnyRouter into a project, migrate from Anthropic / OpenAI / OpenRouter, and call its MCP server. Use when the user mentions AnyRouter, asks to add a unified LLM gateway, wants to swap providers without code churn, migrates an existing OpenAI/Anthropic/OpenRouter integration, sets up Claude Code / Codex / Cursor against a custom base URL, or needs help with model ids like `provider/model`, app attribution headers (`X-AnyRouter-*`), provider preferences, streaming, BYOK, or the AnyRouter MCP server at `https://anyrouter.dev/api/v1/mcp`.
How this skill is triggered — by the user, by Claude, or both
Slash command
/anyrouter:anyrouterThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
AnyRouter is a universal, OpenAI-compatible LLM gateway. One base URL, one API key, 150+ models across 28+ providers, deterministic failover, and a remote MCP server for key + credit management. Use this skill whenever you need to wire AnyRouter into a project or migrate an existing integration.
AnyRouter is a universal, OpenAI-compatible LLM gateway. One base URL, one API key, 150+ models across 28+ providers, deterministic failover, and a remote MCP server for key + credit management. Use this skill whenever you need to wire AnyRouter into a project or migrate an existing integration.
This skill is intentionally thin. It tells you where to look, not what every page says. AnyRouter ships its full documentation as raw markdown, regenerated on every deploy. Before answering any non-trivial AnyRouter question, fetch the relevant .md URL with your web-fetch tool (WebFetch, curl via Bash, or your platform's equivalent) and read the current content. Do not rely on the model id, scope name, or header values memorised in this skill — they can change.
Discovery sources (in priority order):
https://anyrouter.dev/docs.md — auto-generated index. Every section, every page, every link points at the .md mirror. Start here when you don't know which page you need..md to any docs URL — https://anyrouter.dev/docs/<path>.md gives the raw markdown of any rendered page.https://anyrouter.dev/llms-full.txt — every doc concatenated, useful when you want one bulk read.https://anyrouter.dev/llms.txt — short LLM index per llmstxt.org.https://anyrouter.dev/docs/index.json — machine-readable manifest if you need to filter programmatically.Operating rule: when the user asks about AnyRouter, do not paraphrase from this skill alone. Fetch the live .md, ground your answer in it, and cite the URL you used.
| Setting | Value |
|---|---|
| Base URL | https://anyrouter.dev/api/v1 |
| API key env var | ANYROUTER_API_KEY (keys are prefixed sk-ar-) |
| Model id format | provider/model (e.g. openai/gpt-5.4-mini, anthropic/claude-sonnet-4.6) |
| Chat endpoint | POST /chat/completions (OpenAI-compatible) |
| Anthropic-native endpoint | POST /messages (for anthropic/* models) |
| Modern agent endpoint | POST /responses (typed output items + tools) |
| MCP endpoint | https://anyrouter.dev/api/v1/mcp (configured by this plugin) |
| Dashboard | https://anyrouter.dev/dashboard |
| Docs index (markdown) | https://anyrouter.dev/docs.md |
Default model when unspecified: openai/gpt-5.4-mini. Cheap+fast: openai/gpt-5.4-nano, anthropic/claude-haiku-4.5. High-quality: anthropic/claude-sonnet-4.6, openai/gpt-5.4.
Before integrating, check if the project already has an LLM client. If so, change the base URL, key, and model id rather than introducing a new client.
When the user asks something specific (recipes, headers, scopes, model lists, BYOK setup, billing details, rate limits), fetch the matching .md URL before answering. Do not summarise from this skill alone.
Recipe:
https://anyrouter.dev/docs.md first and read the section headings.curl -sSL <url>) to retrieve the raw markdown.Top categories with a one-line summary of every important child page. These hints let you pick the right URL without an index round-trip — the authoritative, current list with every page is always at https://anyrouter.dev/docs.md.
Getting Started
Guides (recipes for agents and migrations)
ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN) route Claude Code through AnyRouter. Includes a claude-ar wrapper recipe.gpt-* → openai/gpt-*).anthropic-version header.provider/model ids, same provider object. Just change base URL and key env./responses endpoint with typed output items + tools.Features (product surface — describe what the platform does)
X-AnyRouter-Provider pinning.X-AnyRouter-Title / -Source / -Version headers; public-ranking surface.@preset/<name> from any request.429 vs 403 semantics; backoff guidance.MCP (configured by this plugin)
API Reference (every inference + management endpoint)
POST /api/v1/chat/completions, OpenAI-compatible, every model.POST /api/v1/messages, Anthropic-compatible passthrough for anthropic/* models.POST /api/v1/responses, structured output items + tools.ak_*) for keys, presets, BYOK, credits.If a URL above 404s, the page was renamed or removed — fetch /docs.md and pick the current link from the live index.
openai SDK)import OpenAI from "openai"
export const llm = new OpenAI({
baseURL: "https://anyrouter.dev/api/v1",
apiKey: process.env.ANYROUTER_API_KEY,
})
export const MODEL = process.env.ANYROUTER_MODEL ?? "openai/gpt-5.4-mini"
export async function generate(prompt: string) {
const r = await llm.chat.completions.create({
model: MODEL,
messages: [{ role: "user", content: prompt }],
})
return r.choices[0]?.message.content ?? ""
}
import os
from openai import OpenAI
client = OpenAI(
base_url="https://anyrouter.dev/api/v1",
api_key=os.environ["ANYROUTER_API_KEY"],
)
resp = client.chat.completions.create(
model=os.getenv("ANYROUTER_MODEL", "openai/gpt-5.4-mini"),
messages=[{"role": "user", "content": "Reply with: anyrouter-ok"}],
)
print(resp.choices[0].message.content)
curl https://anyrouter.dev/api/v1/chat/completions \
-H "Authorization: Bearer $ANYROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-5.4-mini","messages":[{"role":"user","content":"Reply with: anyrouter-ok"}],"max_tokens":20}'
Integration is done when:
https://anyrouter.dev/api/v1ANYROUTER_API_KEY (no inline literal in source)provider/model formexport ANTHROPIC_BASE_URL="https://anyrouter.dev/api"
export ANTHROPIC_AUTH_TOKEN="sk-ar-your-key"
For tier-name pinning and a claude-ar wrapper, see https://anyrouter.dev/docs/guides/claude-code.md.
Any client that accepts a custom OpenAI base URL works. Set:
https://anyrouter.dev/api/v1sk-ar-… from the dashboardprovider/model from the catalogGeneric paste-prompt for any coding agent: https://anyrouter.dev/docs/guides/ai-agent-integration.md.
All three boil down to swap base URL, swap key, keep request shape.
baseURL to https://anyrouter.dev/api/v1, env to ANYROUTER_API_KEY, model id gpt-* → openai/gpt-*. Details: https://anyrouter.dev/docs/guides/migrate-from-openai.md.ANTHROPIC_BASE_URL=https://anyrouter.dev/api (Anthropic-native /messages), or unify on /chat/completions with model: "anthropic/claude-sonnet-4.6". Details: https://anyrouter.dev/docs/guides/migrate-from-anthropic.md.https://anyrouter.dev/api/v1, key env to ANYROUTER_API_KEY. provider.only / .ignore / .order / .sort / .max_price / .allow_fallbacks all map across. Details: https://anyrouter.dev/docs/guides/migrate-from-openrouter.md.Steer routing from the request body:
{
"model": "openai/gpt-5.4-mini",
"provider": {
"only": ["OpenAI", "Groq"],
"order": ["Groq", "OpenAI"],
"sort": "latency",
"allow_fallbacks": true,
"max_price": { "prompt": "1.00", "completion": "4.00" },
"preferred_max_latency": 300,
"preferred_min_throughput": 40
}
}
Pin a single upstream with X-AnyRouter-Provider: <provider_id> — useful for reproducibility, BYOK testing, and outage debugging. Full routing model: https://anyrouter.dev/docs/features/routing.md.
new OpenAI({
baseURL: "https://anyrouter.dev/api/v1",
apiKey: process.env.ANYROUTER_API_KEY,
defaultHeaders: {
"X-AnyRouter-Title": "My App",
"X-AnyRouter-Source": "web-app",
"X-AnyRouter-Version": process.env.APP_VERSION ?? "dev",
},
})
Full schema: https://anyrouter.dev/docs/features/app-attribution.md.
This plugin registers a remote MCP server at https://anyrouter.dev/api/v1/mcp. Tools exposed:
| Tool | Purpose |
|---|---|
list_models | Search the catalog by provider, capability, or context window |
get_credits | Workspace balance and lifetime usage |
list_keys | List API keys |
create_key | Mint a new API key |
revoke_key | Disable a key by id |
list_presets | List saved request presets |
list_conversations | Search workspace conversations |
OAuth runs on first tool call — the user picks Read-only / Standard / Full on the consent screen. There is no chat tool; use the regular chat endpoint for inference.
Full tool catalog, scopes, and manual-auth path: https://anyrouter.dev/docs/api-reference/mcp.md. Client setup for Claude Desktop / Cursor / Claude Code / OpenCode: https://anyrouter.dev/docs/mcp.md.
provider/model ids; never bare model names except via aliases the docs explicitly list.X-AnyRouter-* attribution headers so dashboard analytics work.allow_fallbacks: true unless you're running an eval that needs a fixed upstream.API_TIMEOUT_MS=3000000 for Claude Code).X-RateLimit-Remaining and X-Upstream-RateLimit-Remaining headers.Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
npx claudepluginhub duyet/codex-claude-plugins --plugin anyrouter