openrouter-skill
Orchestrate Chinese LLMs (DeepSeek, Qwen, Yi, Moonshot) through OpenRouter API with LangChain. Use when: openrouter, chinese llm, deepseek, qwen, moonshot, yi model, model routing, auto router, llm orchestration.
What this skill does
<objective>
Enable intelligent routing to Chinese/open-source LLMs through OpenRouter's unified API. Provides model selection guidance, cost optimization, and production patterns for LangChain/LangGraph integration.
</objective>
<quick_start>
## 1. Basic LangChain Setup
```python
from langchain_openai import ChatOpenAI
import os
# Any OpenRouter model works with ChatOpenAI
llm = ChatOpenAI(
model="deepseek/deepseek-chat",
openai_api_key=os.getenv("OPENROUTER_API_KEY"),
openai_api_base="https://openrouter.ai/api/v1",
default_headers={
"HTTP-Referer": "https://your-app.com", # Optional but recommended
"X-Title": "Your App Name"
}
)
response = llm.invoke("Explain quantum computing in simple terms")
```
## 2. Vision Analysis (Charts, Documents)
```python
from langchain_core.messages import HumanMessage
import base64
llm = ChatOpenAI(
model="qwen/qwen-2-vl-72b-instruct",
openai_api_key=os.getenv("OPENROUTER_API_KEY"),
openai_api_base="https://openrouter.ai/api/v1"
)
# From URL
response = llm.invoke([
HumanMessage(content=[
{"type": "text", "text": "Analyze this chart and identify key trends"},
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
])
])
# From base64
with open("chart.png", "rb") as f:
image_data = base64.b64encode(f.read()).decode()
response = llm.invoke([
HumanMessage(content=[
{"type": "text", "text": "What does this chart show?"},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_data}"}}
])
])
```
## 3. Auto-Routing (Let OpenRouter Choose)
```python
# OpenRouter's Auto model selects the best model for your prompt
llm = ChatOpenAI(
model="openrouter/auto", # Powered by NotDiamond
openai_api_key=os.getenv("OPENROUTER_API_KEY"),
openai_api_base="https://openrouter.ai/api/v1"
)
```
</quick_start>
<success_criteria>
- OpenRouter API key configured and authenticated
- Model selection follows the decision tree (vision -> Qwen-VL, code -> DeepSeek Coder, etc.)
- LangChain ChatOpenAI integration working with correct base URL and headers
- Cost savings of 60-97% vs Western model equivalents for comparable quality
- Fallback chain configured for production reliability
</success_criteria>
<core_concepts>
## Model Selection Decision Tree
```
Task Type
│
├─ Vision/Charts ──────────> qwen/qwen-2-vl-72b-instruct ($0.40/M)
├─ Code Generation ────────> deepseek/deepseek-coder ($0.14/$0.28)
├─ Deep Reasoning ─────────> qwen/qwq-32b ($0.15/$0.40)
├─ Long Documents ─────────> moonshot/moonshot-v1-128k ($0.55/M)
├─ Fast/Cheap Tasks ───────> qwen/qwen-2.5-7b-instruct ($0.09/M)
├─ General Analysis ───────> deepseek/deepseek-chat ($0.27/$1.10)
└─ Unknown/Auto ───────────> openrouter/auto
```
## Top Chinese LLMs
| Model | Best For | Cost ($/1M tokens) |
|-------|----------|-------------------|
| `deepseek/deepseek-chat` | General reasoning, analysis | $0.27 in / $1.10 out |
| `deepseek/deepseek-coder` | Code generation | $0.14 / $0.28 |
| `qwen/qwen-2-vl-72b-instruct` | Vision, charts | $0.40 / $0.40 |
| `qwen/qwen-2.5-7b-instruct` | Fast, cheap tasks | $0.09 / $0.09 |
| `qwen/qwq-32b` | Deep reasoning | $0.15 / $0.40 |
| `moonshot/moonshot-v1-128k` | Long context (128K) | $0.55 / $0.55 |
## Cost Comparison vs Western Models
| Task | Western Model | Cost | Chinese Model | Cost | Savings |
|------|--------------|------|---------------|------|---------|
| Chat | GPT-4o | $5.00/$15.00 | DeepSeek Chat | $0.27/$1.10 | **95%** |
| Code | Claude Sonnet | $3.00/$15.00 | DeepSeek Coder | $0.14/$0.28 | **95%** |
| Vision | GPT-4o | $5.00/$15.00 | Qwen-VL | $0.40/$0.40 | **97%** |
| Fast | GPT-4o-mini | $0.15/$0.60 | Qwen-7B | $0.09/$0.09 | **60%** |
## LangGraph Multi-Model Factory
```python
from enum import Enum
from langchain_openai import ChatOpenAI
import os
class ChineseModel(str, Enum):
DEEPSEEK_CHAT = "deepseek/deepseek-chat"
DEEPSEEK_CODER = "deepseek/deepseek-coder"
QWEN_VL = "qwen/qwen-2-vl-72b-instruct"
QWEN_FAST = "qwen/qwen-2.5-7b-instruct"
QWQ_REASONING = "qwen/qwq-32b"
MOONSHOT_LONG = "moonshot/moonshot-v1-128k"
AUTO = "openrouter/auto"
def create_llm(model: ChineseModel, **kwargs) -> ChatOpenAI:
"""Factory for OpenRouter LLMs with sensible defaults."""
return ChatOpenAI(
model=model.value,
openai_api_key=os.getenv("OPENROUTER_API_KEY"),
openai_api_base="https://openrouter.ai/api/v1",
default_headers={
"HTTP-Referer": os.getenv("APP_URL", "http://localhost"),
"X-Title": os.getenv("APP_NAME", "LangChain App")
},
**kwargs
)
# Usage
chat_llm = create_llm(ChineseModel.DEEPSEEK_CHAT)
vision_llm = create_llm(ChineseModel.QWEN_VL)
fast_llm = create_llm(ChineseModel.QWEN_FAST, temperature=0)
```
## Environment Setup
```bash
# .env
OPENROUTER_API_KEY=sk-or-v1-...
APP_URL=https://your-app.com # For attribution (optional)
APP_NAME=Your App Name # For attribution (optional)
```
</core_concepts>
<routing>
For detailed information, see:
- `reference/models-catalog.md` - Complete model listing with capabilities
- `reference/routing-strategies.md` - Auto, provider, and custom routing
- `reference/langchain-integration.md` - LangChain/LangGraph patterns
- `reference/cost-optimization.md` - Budget management and caching
- `reference/tool-calling.md` - Function calling patterns
- `reference/multimodal.md` - Vision, PDF, audio support
- `reference/observability.md` - Monitoring and tracing
</routing>
<checklist>
When implementing OpenRouter integration:
- [ ] Set OPENROUTER_API_KEY environment variable
- [ ] Choose appropriate model for task type (see decision tree)
- [ ] Use ChatOpenAI with openai_api_base="https://openrouter.ai/api/v1"
- [ ] Add HTTP-Referer and X-Title headers for attribution
- [ ] Consider cost implications (Chinese models are 10-100x cheaper)
- [ ] Enable streaming for chat interfaces
- [ ] Implement fallback chain for production reliability
- [ ] Set up cost tracking/budget limits
## Emit Outcome Sidecar
As the final step, write to `~/.claude/skill-analytics/last-outcome-openrouter.json`:
```json
{"ts":"[UTC ISO8601]","skill":"openrouter","version":"1.0.0","variant":"default",
"status":"[success|partial|error]","runtime_ms":[estimated ms from start],
"metrics":{"requests_routed":[n],"models_used":[n],"total_cost_usd":[n]},
"error":null,"session_id":"[YYYY-MM-DD]"}
```
Use status "partial" if some stages failed but results were produced. Use "error" only if no output was generated.
</checklist>
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.