OpenClaw Skill
Openrouter Toolkit
Install
$npx clawhub@latest install openrouter-toolkit
View on GitHubv1.0.0
All-time installs5
Active installs5
Stars1
๐ OpenRouter Toolkit
The definitive OpenRouter skill for OpenClaw agents. Intelligent model routing, cost tracking, fallback chains, and model comparison โ all in one toolkit.
Features
- Smart Routing โ Automatically pick the best model for code, reasoning, creative, fast, or cheap tasks
- Cost Tracking โ Log every API call with cost, track daily/weekly/monthly spend
- Fallback Chains โ If primary model fails or times out, auto-retry with fallbacks
- Model Comparison โ Send the same prompt to N models, compare quality and cost side-by-side
- Budget Alerts โ Set spending limits and get warned before you blow your budget
- Live Model Data โ Pulls real pricing and capabilities from OpenRouter's API
Requirements
OPENROUTER_API_KEYโ Your OpenRouter API key- Python 3.10+ with
requests(included in most environments)
Usage
Smart Routing
bash
python3 {baseDir}/scripts/openrouter_toolkit.py route --task code
python3 {baseDir}/scripts/openrouter_toolkit.py route --task reasoning
python3 {baseDir}/scripts/openrouter_toolkit.py route --task creative
python3 {baseDir}/scripts/openrouter_toolkit.py route --task fast
python3 {baseDir}/scripts/openrouter_toolkit.py route --task cheapModel Comparison
bash
python3 {baseDir}/scripts/openrouter_toolkit.py compare --prompt "Explain recursion" --models "anthropic/claude-sonnet-4,openai/gpt-4o-mini"Fallback Chain
bash
python3 {baseDir}/scripts/openrouter_toolkit.py fallback --prompt "Hello" --chain "anthropic/claude-opus-4,anthropic/claude-sonnet-4,openai/gpt-4o-mini"Cost Tracking
bash
python3 {baseDir}/scripts/openrouter_toolkit.py cost --period daily
python3 {baseDir}/scripts/openrouter_toolkit.py cost --period weekly
python3 {baseDir}/scripts/openrouter_toolkit.py cost --period monthlyBudget Alerts
bash
python3 {baseDir}/scripts/openrouter_toolkit.py budget --set 50.00
python3 {baseDir}/scripts/openrouter_toolkit.py budget --checkList Models
bash
python3 {baseDir}/scripts/openrouter_toolkit.py models --top 20
python3 {baseDir}/scripts/openrouter_toolkit.py models --search claude
python3 {baseDir}/scripts/openrouter_toolkit.py models --best codeHow Smart Routing Works
The router scores models based on task type using these heuristics:
| Task | Prioritizes | Example Models |
|---|---|---|
| code | High context, code benchmarks | Claude Opus, GPT-4o |
| reasoning | Thinking/reasoning capability | Claude Opus, o1 |
| creative | Creative writing quality | Claude Sonnet, GPT-4o |
| fast | Low latency, good enough quality | Claude Haiku, GPT-4o-mini |
| cheap | Lowest cost per token | Gemini Flash, GPT-4o-mini |
Data Storage
Cost logs are stored in SQLite at {baseDir}/data/openrouter_costs.db.
Credits
Built by M. Abidi | agxntsix.ai YouTube | GitHub Part of the AgxntSix Skill Suite for OpenClaw agents.
๐ Need help setting up OpenClaw for your business? Book a free consultation
Created by
@aiwithabidiPersistent memory
Give your OpenClaw agent a memory layer
Mem0 remembers users and context across sessions so you send fewer tokens and get better answers.
Try Mem0Mem0 + OpenClaw guide