| name | setup-openrouter |
| description | Configure OpenRouter as the cloud-LLM backend for skills in this plugin. Use when a skill needs cloud LLM access and the user wants pay-as-you-go routing across Claude, GPT, Gemini, DeepSeek, Llama, Qwen without managing multiple provider keys. |
Setup OpenRouter
Single API key, access to ~every hosted LLM.
Why OpenRouter here
- Unified billing and model catalog — easy to swap cheap↔premium per task.
- Live pricing visible per model; easy to pick cost-optimal for bulk runs.
- OpenAI-compatible API — drop-in with the OpenAI SDK.
Procedure
-
Key: check env for OPENROUTER_API_KEY. If absent, ask the user to set it (point at 1Password if they use op-vault). Never print the key.
-
Endpoint: https://openrouter.ai/api/v1 — set as OPENAI_BASE_URL with the OpenAI SDK.
-
Recommended model aliases (update when prices shift — check openrouter.ai/models):
| Tier | Model id (OpenRouter) | Good for |
|---|
| Ultra-cheap | deepseek/deepseek-chat, google/gemini-2.0-flash-001 | Bulk classification, labeling |
| Cheap | anthropic/claude-haiku-4-5, openai/gpt-4o-mini | Classification with higher quality, summarization |
| Premium | anthropic/claude-sonnet-4-6, anthropic/claude-opus-4-7, openai/gpt-4o | Taxonomy design, nuanced labeling, residue review |
| Embeddings | openai/text-embedding-3-small (direct OpenAI), or local sentence-transformers | Clustering, similarity |
Prices change — always fetch current pricing before large runs.
-
Test call: send a 1-token completion to verify routing + key.
-
Set safe defaults in a shared config:
- Max tokens per call.
- Concurrent request limit (start at 10).
- Timeout + retry policy (exponential backoff on 429/5xx).
-
Enable prompt caching for providers that support it (Anthropic, OpenAI) — huge savings on repeated system prompts in classification/taxonomy work.
Cost guardrails
- Any skill invoking OpenRouter on >1000 docs must pre-compute an estimate via
choose-approach.
- Set a per-run
max_spend_usd envelope; abort if projected exceed.
- Log every call's input/output token count and estimated cost to
logs/openrouter-calls.jsonl.
Privacy
OpenRouter forwards to the chosen provider. If the corpus is sensitive, prefer setup-local-llm.