hub-skill
Xrouter is an open-source inference router that sits between OpenClaw and your LLM providers. It uses a fast, hardware-aware classifier to route each request…
от rondoflow★ 37 звёзд на GitHub
Установить hub-skill в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Xrouter
Xrouter is an open-source inference router that sits between OpenClaw and your LLM providers. It uses a fast, hardware-aware classifier to route each request to the most cost-effective model that can handle the task.
This project is MIT licensed. See the MIT License.
Core Features
- OpenAI-compatible reverse proxy at
POST /v1/chat/completions. - 3-tier classifier (0 = cheap, 1 = medium, 2 = frontier) with early stream cutoff.
- Hardware detection helper to recommend local engine.
- Provider selection wizard to choose local and cloud endpoints.
- Cache layer with Redis or in-memory LRU fallback.
- Full cloud mode when local inference is not viable.
- Token tracking dashboard at
/dashboard.
Workflow
flowchart TD
A["Client / OpenClaw request"] --> B["Router (OpenAI-compatible)"]
B --> C{"Classifier enabled?"}
C -->|No| F["Route to Frontier provider"]
C -->|Yes| D["Classifier (0 / 1 / 2)"]
D --> E{"Decision"}
E -->|0| G["Route to Cheap provider"]
E -->|1| M["Route to Medium provider"]
E -->|2| F
G --> H["Provider adapter (auto or explicit)"]
M --> H
F --> H
H --> I["Upstream API call"]
I --> J["Stream/Response back to client"]
Repository Layout
src/server.js: router and streaming proxy.src/classifier.js: classifier call and retry logic.src/config.js: configuration and env parsing.src/cache.js: Redis + LRU cache.src/token_tracker.js: token tracking.scripts/check_hw.js: hardware detection.scripts/configure_providers.js: interactive provider setup.
Requirements
- Node.js 20+.
- Local classifier engine (optional).
- A frontier provider endpoint (required).
Quickstart
- Install dependencies.
- (Optional) Start a local model server.
- Run the configuration wizard.
- Start the router.
npm install
npm run configure
npm run dev
How To Use
- Start your local model server (optional but recommended).
- Run the wizard to configure providers and models.
- Start the router.
- Send OpenAI-compatible requests to the router.
- Inspect routing decisions in response headers or the dashboard.
Example local setup (Ollama):
ollama pull llama3.1
ollama run llama3.1
Run the wizard:
npm run configure
Start the router:
npm run dev
Test a request:
curl -i http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"any","messages":[{"role":"user","content":"Fix this sentence: I has a apple."}]}'
Look for these headers:
X-Xrouter-decision:0,1, or2.X-Xrouter-upstream:cheap,medium, orfrontier.
Open the dashboard:
http://localhost:3000/dashboard
Raw usage JSON:
http://localhost:3000/usage
Provider Selection (Terminal Wizard) Run:
npm run configure
The wizard:
- Scans hardware and recommends a local engine.
- Suggests a local classifier model.
- Lets you choose provider base URLs, API keys, and model overrides for cheap/medium/frontier routes.
- Writes
upstreams.jsonand optionally updates.env.
Quick Start Mode
- If your machine can run a local model, you can choose Quick Start.
- Quick Start auto-configures the local classifier.
- Cheap route always uses the same local model as the classifier to avoid Ollama model swapping.
- You only need to choose medium and frontier providers/models.
- On Apple Silicon (Ollama), the wizard lists installed Ollama models and can auto-download a recommended model.
Routing Behavior
- The classifier is called for each uncached request.
- The first
0,1, or2token returned decides the route. - If classification fails, the router defaults to the frontier route.
- When the classifier is enabled, cheap, medium, and frontier routes must be configured.
Compatibility
- The router accepts OpenAI-style requests and translates when needed.
- Provider type can be explicit (
xrouter,openai_compatible,openai,anthropic,gemini,cohere,azure_openai,mistral,groq,together,perplexity) orauto. autoinfers the provider adapter from the base URL or API key.- Providers that expose OpenAI-compatible endpoints use the
openai_compatibleadapter. - Anthropic/Gemini/Cohere streaming is translated into OpenAI-style SSE chunks.
- Non-OpenAI adapters currently support text-only messages and basic sampling params (temperature/top_p/stop).
Token Tracking Dashboard
GET /usage: returns cumulative token usage forcheap,medium, andfrontier.GET /dashboard: UI that displays token split and totals.- Local usage is counted inside
cheapwhen cheap uses the local model.
Environment Summary
HOST: bind host, default0.0.0.0.PORT: bind port, default3000.ROUTER_API_KEY: requireAuthorization: Bearer <key>.LOG_LEVEL: log level (debug/info/warn/error).LOG_TO_FILE: settrueto write logs to files.LOG_DIR: directory for log files (de
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- manifest.json
FAQ
Что делает скилл hub-skill?
Xrouter is an open-source inference router that sits between OpenClaw and your LLM providers. It uses a fast, hardware-aware classifier to route each request to the most cost-effective model that can handle the task.
Как установить скилл hub-skill?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hub-skill запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…