[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CKJRQD59RG82CW75CNH700":3,"skill-same:01M6CKJRQD59RG82CW75CNH700":101},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":6,"ownerHtmlUrl":63,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":64,"install":65,"resources":78},"01M6CKJRQD59RG82CW75CNH700","llmrouter",null,"Intelligent LLM proxy that routes requests to appropriate models based on complexity. Save money by using cheaper models for simple tasks. Tested with Anthropic, OpenAI, Gemini, Kimi\u002FMoonshot, and Ollama.","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Falexrudloff\u002Fllmrouter\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[5,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"ollama","save money","money","simple","models","kimi","complexity","llm proxy","python3","gemini","save","api","https","proxy","openai","tasks","linux","github","2026-11-10 10:12:30",false,"---\nname: llmrouter\ndescription: Intelligent LLM proxy that routes requests to appropriate models based on complexity. Save money by using cheaper models for simple tasks. Tested with Anthropic, OpenAI, Gemini, Kimi\u002FMoonshot, and Ollama.\nhomepage: https:\u002F\u002Fgithub.com\u002Falexrudloff\u002Fllmrouter\nmetadata: {\"openclaw\":{\"emoji\":\"?\",\"homepage\":\"https:\u002F\u002Fgithub.com\u002Falexrudloff\u002Fllmrouter\",\"os\":[\"darwin\",\"linux\"],\"requires\":{\"bins\":[\"python3\"],\"anyBins\":[\"pip\",\"pip3\"]},\"primaryEnv\":\"ANTHROPIC_API_KEY\"}}\n---\n\n# LLM Router\n\nAn intelligent proxy that classifies incoming requests by complexity and routes them to appropriate LLM models. Use cheaper\u002Ffaster models for simple tasks and reserve expensive models for complex ones.\n\n**Works with [OpenClaw](https:\u002F\u002Fgithub.com\u002Fopenclaw\u002Fopenclaw)** to reduce token usage and API costs by routing simple requests to smaller models.\n\n**Status:** Tested with Anthropic, OpenAI, Google Gemini, Kimi\u002FMoonshot, and Ollama.\n\n## Quick Start\n\n### Prerequisites\n\n1. **Python 3.10+** with pip\n2. **Ollama** (optional - only if using local classification)\n3. **Anthropic API key** or Claude Code OAuth token (or other provider key)\n\n### Setup\n\n```bash\n# Clone if not already present\ngit clone https:\u002F\u002Fgithub.com\u002Falexrudloff\u002Fllmrouter.git\ncd llmrouter\n\n# Create virtual environment (required on modern Python)\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Pull classifier model (if using local classification)\nollama pull qwen2.5:3b\n\n# Copy and customize config\ncp config.yaml.example config.yaml\n# Edit config.yaml with your API key and model preferences\n```\n\n### Verify Installation\n\n```bash\n# Start the server\nsource venv\u002Fbin\u002Factivate\npython server.py\n\n# In another terminal, test health endpoint\ncurl http:\u002F\u002Flocalhost:4001\u002Fhealth\n# Should return: {\"status\": \"ok\", ...}\n```\n\n### Start the Server\n\n```bash\npython server.py\n```\n\nOptions:\n- `--port PORT` - Port to listen on (default: 4001)\n- `--host HOST` - Host to bind (default: 127.0.0.1)\n- `--config PATH` - Config file path (default: config.yaml)\n- `--log` - Enable verbose logging\n- `--openclaw` - Enable OpenClaw compatibility (rewrites model name in system prompt)\n\n## Configuration\n\nEdit `config.yaml` to customize:\n\n### Model Routing\n\n```yaml\n# Anthropic routing\nmodels:\n  super_easy: \"anthropic:claude-haiku-4-5-20251001\"\n  easy: \"anthropic:claude-haiku-4-5-20251001\"\n  medium: \"anthropic:claude-sonnet-4-20250514\"\n  hard: \"anthropic:claude-opus-4-20250514\"\n  super_hard: \"anthropic:claude-opus-4-20250514\"\n\n# OpenAI routing\nmodels:\n  super_easy: \"openai:gpt-4o-mini\"\n  easy: \"openai:gpt-4o-mini\"\n  medium: \"openai:gpt-4o\"\n  hard: \"openai:o3-mini\"\n  super_hard: \"openai:o3\"\n\n# Google Gemini routing\nmodels:\n  super_easy: \"google:gemini-2.0-flash\"\n  easy: \"google:gemini-2.0-flash\"\n  medium: \"google:gemini-2.0-flash\"\n  hard: \"google:gemini-2.0-flash\"\n  super_hard: \"google:gemini-2.0-flash\"\n```\n\n**Note:** Reasoning models are auto-detected and use correct API params.\n\n### Classifier\n\nThree options for classifying request complexity:\n\n**Local (default)** - Free, requires Ollama:\n```yaml\nclassifier:\n  provider: \"local\"\n  model: \"qwen2.5:3b\"\n```\n\n**Anthropic** - Uses Haiku, fast and cheap:\n```yaml\nclassifier:\n  provider: \"anthropic\"\n  model: \"claude-haiku-4-5-20251001\"\n```\n\n**OpenAI** - Uses GPT-4o-mini:\n```yaml\nclassifier:\n  provider: \"openai\"\n  model: \"gpt-4o-mini\"\n```\n\n**Google** - Uses Gemini:\n```yaml\nclassifier:\n  provider: \"google\"\n  model: \"gemini-2.0-flash\"\n```\n\n**Kimi** - Uses Moonshot:\n```yaml\nclassifier:\n  provider: \"kimi\"\n  model: \"moonshot-v1-8k\"\n```\n\nUse remote (anthropic\u002Fopenai\u002Fgoogle\u002Fkimi) if your machine can't run local models.\n\n### Supported Providers\n\n- `anthropic:claude-*` - Anthropic Claude models (tested)\n- `openai:gpt-*`, `openai:o1-*`, `openai:o3-*` - OpenAI models (tested)\n- `google:gemini-*` - Google Gemini models (tested)\n- `kimi:kimi-k2.5`, `kimi:moonshot-*` - Kimi\u002FMoonshot models (tested)\n- `local:model-name` - Local Ollama models (tested)\n\n## Complexity Levels\n\n| Level | Use Case | Default Model |\n|-------|----------|---------------|\n| super_easy | Greetings, acknowledgments | Haiku |\n| easy | Simple Q&A, reminders | Haiku |\n| medium | Coding, emails, research | Sonnet |\n| hard | Complex reasoning, debugging | Opus |\n| super_hard | System architecture, proofs | Opus |\n\n## Customizing Classification\n\nEdit `ROUTES.md` to tune how messages are classified. The classifier reads the table in this file to determine complexity levels.\n\n## API Usage\n\nThe router exposes an OpenAI-compatible API:\n\n```bash\ncurl http:\u002F\u002Flocalhost:4001\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer $ANTHROPIC_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"llm-router\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n  }'\n```\n\n## Testing Classification\n\n```bash\npython classifier.py \"Write a Python sort function\"\n# Output: medium\n\npython classifier.py --test\n# Runs test suite\n```\n\n## Running as macOS Service\n\nCreate `~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist`:\n\n```xml\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE plist PUBLIC \"-\u002F\u002FApple\u002F\u002FDTD PLIST 1.0\u002F\u002FEN\" \"http:\u002F\u002Fwww.apple.com\u002FDTDs\u002FPropertyList-1.0.dtd\">\n\u003Cplist version=\"1.0\">\n\u003Cdict>\n    \u003Ckey>Label\u003C\u002Fkey>\n    \u003Cstring>com.llmrouter\u003C\u002Fstring>\n    \u003Ckey>ProgramArguments\u003C\u002Fkey>\n    \u003Carray>\n        \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Fvenv\u002Fbin\u002Fpython\u003C\u002Fstring>\n        \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Fserver.py\u003C\u002Fstring>\n        \u003Cstring>--openclaw\u003C\u002Fstring>\n    \u003C\u002Farray>\n    \u003Ckey>RunAtLoad\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>KeepAlive\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>WorkingDirectory\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u003C\u002Fstring>\n    \u003Ckey>StandardOutPath\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstdout.log\u003C\u002Fstring>\n    \u003Ckey>StandardErrorPath\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstderr.log\u003C\u002Fstring>\n\u003C\u002Fdict>\n\u003C\u002Fplist>\n```\n\n**Important:** Replace `\u002Fpath\u002Fto\u002Fllmrouter` with your actual install path. Must use the venv python, not system python.\n\n```bash\n# Create logs directory\nmkdir -p ~\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\n\n# Load the service\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\n\n# Verify it's running\ncurl http:\u002F\u002Flocalhost:4001\u002Fhealth\n\n# To stop\u002Frestart\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\n```\n\n## OpenClaw Configuration\n\nAdd the router as a provider in `~\u002F.openclaw\u002Fopenclaw.json`:\n\n```json\n{\n  \"models\": {\n    \"providers\": {\n      \"localrouter\": {\n        \"baseUrl\": \"http:\u002F\u002Flocalhost:4001\u002Fv1\",\n        \"apiKey\": \"via-router\",\n        \"api\": \"openai-completions\",\n        \"models\": [\n          {\n            \"id\": \"llm-router\",\n            \"name\": \"LLM Router (Auto-routes by complexity)\",\n            \"reasoning\": false,\n            \"input\": [\"text\", \"image\"],\n            \"cost\": {\n              \"input\": 0,\n              \"output\": 0,\n              \"cacheRead\": 0,\n              \"cacheWrite\": 0\n            },\n            \"contextWindow\": 200000,\n            \"maxTokens\": 8192\n          }\n        ]\n      }\n    }\n  }\n}\n```\n\n**Note:** Cost is set to 0 because actual costs depend on which model the router selects. The router logs which model handled each request.\n\n### Set as Default Model (Optional)\n\nTo use the router for all agents by default, add:\n\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"model\": {\n        \"primary\": \"localrouter\u002Fllm-router\"\n      }\n    }\n  }\n}\n```\n\n### Using with OAuth Tokens\n\nIf your `config.yaml` uses an Anthropic OAuth token from OpenClaw's `~\u002F.openclaw\u002Fauth-profiles.json`, the router automatically handles Claude Code identity headers.\n\n### OpenClaw Compatibility Mode (Required)\n\n**If using with OpenClaw, you MUST start the server with `--openclaw`:**\n\n```bash\npython server.py --openclaw\n```\n\nThis flag enables compatibility features required for OpenClaw:\n- Rewrites model names in responses so OpenClaw shows the actual model being used\n- Handles tool name and ID remapping for proper tool call routing\n\nWithout this flag, you may encounter errors when using the router with OpenClaw.\n\n## Common Tasks\n\n- **Check server status**: `curl http:\u002F\u002Flocalhost:4001\u002Fhealth`\n- **View current config**: `cat config.yaml`\n- **Test a classification**: `python classifier.py \"your message\"`\n- **Run classification tests**: `python classifier.py --test`\n- **Restart server**: Stop and run `python server.py` again\n- **View logs** (if running as service): `tail -f logs\u002Fstdout.log`\n\n## Troubleshooting\n\n### \"externally-managed-environment\" error\nPython 3.11+ requires virtual environments. Create one:\n```bash\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\npip install -r requirements.txt\n```\n\n### \"Connection refused\" on port 4001\nServer isn't running. Start it:\n```bash\nsource venv\u002Fbin\u002Factivate && python server.py\n```\n\n### Classification returns wrong complexity\nEdit `ROUTES.md` to tune classification rules. The classifier reads this file to determine complexity levels.\n\n### Ollama errors \u002F \"model not found\"\nEnsure Ollama is running and the model is pulled:\n```bash\nollama serve  # Start Ollama if not running\nollama pull qwen2.5:3b\n```\n\n### OAuth token not working\nEnsure your token in `config.yaml` starts with `sk-ant-oat`. The router auto-detects OAuth tokens and adds required identity headers.\n\n### LaunchAgent not starting\nCheck logs and ensure paths are absolute:\n```bash\ncat ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist  # Verify paths\ncat \u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstderr.log  # Check for errors\n```\n","# LLM Router\n\nAn intelligent proxy that classifies incoming requests by complexity and routes them to appropriate LLM models. Use cheaper\u002Ffaster models for simple tasks and reserve expensive models for complex ones.\n\n**Works with [OpenClaw](https:\u002F\u002Fgithub.com\u002Fopenclaw\u002Fopenclaw)** to reduce token usage and API costs by routing simple requests to smaller models.\n\n**Status:** Tested with Anthropic, OpenAI, Google Gemini, Kimi\u002FMoonshot, and Ollama.\n\n## Quick Start\n\n### Prerequisites\n\n1. **Python 3.10+** with pip\n2. **Ollama** (optional - only if using local classification)\n3. **Anthropic API key** or Claude Code OAuth token (or other provider key)\n\n### Setup\n\n```bash\n# Clone if not already present\ngit clone https:\u002F\u002Fgithub.com\u002Falexrudloff\u002Fllmrouter.git\ncd llmrouter\n\n# Create virtual environment (required on modern Python)\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Pull classifier model (if using local classification)\nollama pull qwen2.5:3b\n\n# Copy and customize config\ncp config.yaml.example config.yaml\n# Edit config.yaml with your API key and model preferences\n```\n\n### Verify Installation\n\n```bash\n# Start the server\nsource venv\u002Fbin\u002Factivate\npython server.py\n\n# In another terminal, test health endpoint\ncurl http:\u002F\u002Flocalhost:4001\u002Fhealth\n# Should return: {\"status\": \"ok\", ...}\n```\n\n### Start the Server\n\n```bash\npython server.py\n```\n\nOptions:\n- `--port PORT` - Port to listen on (default: 4001)\n- `--host HOST` - Host to bind (default: 127.0.0.1)\n- `--config PATH` - Config file path (default: config.yaml)\n- `--log` - Enable verbose logging\n- `--openclaw` - Enable OpenClaw compatibility (rewrites model name in system prompt)\n\n## Configuration\n\nEdit `config.yaml` to customize:\n\n### Model Routing\n\n```yaml\n# Anthropic routing\nmodels:\n  super_easy: \"anthropic:claude-haiku-4-5-20251001\"\n  easy: \"anthropic:claude-haiku-4-5-20251001\"\n  medium: \"anthropic:claude-sonnet-4-20250514\"\n  hard: \"anthropic:claude-opus-4-20250514\"\n  super_hard: \"anthropic:claude-opus-4-20250514\"\n\n# OpenAI routing\nmodels:\n  super_easy: \"openai:gpt-4o-mini\"\n  easy: \"openai:gpt-4o-mini\"\n  medium: \"openai:gpt-4o\"\n  hard: \"openai:o3-mini\"\n  super_hard: \"openai:o3\"\n\n# Google Gemini routing\nmodels:\n  super_easy: \"google:gemini-2.0-flash\"\n  easy: \"google:gemini-2.0-flash\"\n  medium: \"google:gemini-2.0-flash\"\n  hard: \"google:gemini-2.0-flash\"\n  super_hard: \"google:gemini-2.0-flash\"\n```\n\n**Note:** Reasoning models are auto-detected and use correct API params.\n\n### Classifier\n\nThree options for classifying request complexity:\n\n**Local (default)** - Free, requires Ollama:\n```yaml\nclassifier:\n  provider: \"local\"\n  model: \"qwen2.5:3b\"\n```\n\n**Anthropic** - Uses Haiku, fast and cheap:\n```yaml\nclassifier:\n  provider: \"anthropic\"\n  model: \"claude-haiku-4-5-20251001\"\n```\n\n**OpenAI** - Uses GPT-4o-mini:\n```yaml\nclassifier:\n  provider: \"openai\"\n  model: \"gpt-4o-mini\"\n```\n\n**Google** - Uses Gemini:\n```yaml\nclassifier:\n  provider: \"google\"\n  model: \"gemini-2.0-flash\"\n```\n\n**Kimi** - Uses Moonshot:\n```yaml\nclassifier:\n  provider: \"kimi\"\n  model: \"moonshot-v1-8k\"\n```\n\nUse remote (anthropic\u002Fopenai\u002Fgoogle\u002Fkimi) if your machine can't run local models.\n\n### Supported Providers\n\n- `anthropic:claude-*` - Anthropic Claude models (tested)\n- `openai:gpt-*`, `openai:o1-*`, `openai:o3-*` - OpenAI models (tested)\n- `google:gemini-*` - Google Gemini models (tested)\n- `kimi:kimi-k2.5`, `kimi:moonshot-*` - Kimi\u002FMoonshot models (tested)\n- `local:model-name` - Local Ollama models (tested)\n\n## Complexity Levels\n\n| Level | Use Case | Default Model |\n|-------|----------|---------------|\n| super_easy | Greetings, acknowledgments | Haiku |\n| easy | Simple Q&A, reminders | Haiku |\n| medium | Coding, emails, research | Sonnet |\n| hard | Complex reasoning, debugging | Opus |\n| super_hard | System architecture, proofs | Opus |\n\n## Customizing Classification\n\nEdit `ROUTES.md` to tune how messages are classified. The classifier reads the table in this file to determine complexity levels.\n\n## API Usage\n\nThe router exposes an OpenAI-compatible API:\n\n```bash\ncurl http:\u002F\u002Flocalhost:4001\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer $ANTHROPIC_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"llm-router\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n  }'\n```\n\n## Testing Classification\n\n```bash\npython classifier.py \"Write a Python sort function\"\n# Output: medium\n\npython classifier.py --test\n# Runs test suite\n```\n\n## Running as macOS Service\n\nCreate `~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist`:\n\n```xml\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE plist PUBLIC \"-\u002F\u002FApple\u002F\u002FDTD PLIST 1.0\u002F\u002FEN\" \"http:\u002F\u002Fwww.apple.com\u002FDTDs\u002FPropertyList-1.0.dtd\">\n\u003Cplist version=\"1.0\">\n\u003Cdict>\n    \u003Ckey>Label\u003C\u002Fkey>\n    \u003Cstring>com.llmrouter\u003C\u002Fstring>\n    \u003Ckey>ProgramArguments\u003C\u002Fkey>\n    \u003Carray>\n        \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Fvenv\u002Fbin\u002Fpython\u003C\u002Fstring>\n        \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Fserver.py\u003C\u002Fstring>\n        \u003Cstring>--openclaw\u003C\u002Fstring>\n    \u003C\u002Farray>\n    \u003Ckey>RunAtLoad\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>KeepAlive\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>WorkingDirectory\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u003C\u002Fstring>\n    \u003Ckey>StandardOutPath\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstdout.log\u003C\u002Fstring>\n    \u003Ckey>StandardErrorPath\u003C\u002Fkey>\n    \u003Cstring>\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstderr.log\u003C\u002Fstring>\n\u003C\u002Fdict>\n\u003C\u002Fplist>\n```\n\n**Important:** Replace `\u002Fpath\u002Fto\u002Fllmrouter` with your actual install path. Must use the venv python, not system python.\n\n```bash\n# Create logs directory\nmkdir -p ~\u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\n\n# Load the service\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\n\n# Verify it's running\ncurl http:\u002F\u002Flocalhost:4001\u002Fhealth\n\n# To stop\u002Frestart\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist\n```\n\n## OpenClaw Configuration\n\nAdd the router as a provider in `~\u002F.openclaw\u002Fopenclaw.json`:\n\n```json\n{\n  \"models\": {\n    \"providers\": {\n      \"localrouter\": {\n        \"baseUrl\": \"http:\u002F\u002Flocalhost:4001\u002Fv1\",\n        \"apiKey\": \"via-router\",\n        \"api\": \"openai-completions\",\n        \"models\": [\n          {\n            \"id\": \"llm-router\",\n            \"name\": \"LLM Router (Auto-routes by complexity)\",\n            \"reasoning\": false,\n            \"input\": [\"text\", \"image\"],\n            \"cost\": {\n              \"input\": 0,\n              \"output\": 0,\n              \"cacheRead\": 0,\n              \"cacheWrite\": 0\n            },\n            \"contextWindow\": 200000,\n            \"maxTokens\": 8192\n          }\n        ]\n      }\n    }\n  }\n}\n```\n\n**Note:** Cost is set to 0 because actual costs depend on which model the router selects. The router logs which model handled each request.\n\n### Set as Default Model (Optional)\n\nTo use the router for all agents by default, add:\n\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"model\": {\n        \"primary\": \"localrouter\u002Fllm-router\"\n      }\n    }\n  }\n}\n```\n\n### Using with OAuth Tokens\n\nIf your `config.yaml` uses an Anthropic OAuth token from OpenClaw's `~\u002F.openclaw\u002Fauth-profiles.json`, the router automatically handles Claude Code identity headers.\n\n### OpenClaw Compatibility Mode (Required)\n\n**If using with OpenClaw, you MUST start the server with `--openclaw`:**\n\n```bash\npython server.py --openclaw\n```\n\nThis flag enables compatibility features required for OpenClaw:\n- Rewrites model names in responses so OpenClaw shows the actual model being used\n- Handles tool name and ID remapping for proper tool call routing\n\nWithout this flag, you may encounter errors when using the router with OpenClaw.\n\n## Common Tasks\n\n- **Check server status**: `curl http:\u002F\u002Flocalhost:4001\u002Fhealth`\n- **View current config**: `cat config.yaml`\n- **Test a classification**: `python classifier.py \"your message\"`\n- **Run classification tests**: `python classifier.py --test`\n- **Restart server**: Stop and run `python server.py` again\n- **View logs** (if running as service): `tail -f logs\u002Fstdout.log`\n\n## Troubleshooting\n\n### \"externally-managed-environment\" error\nPython 3.11+ requires virtual environments. Create one:\n```bash\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\npip install -r requirements.txt\n```\n\n### \"Connection refused\" on port 4001\nServer isn't running. Start it:\n```bash\nsource venv\u002Fbin\u002Factivate && python server.py\n```\n\n### Classification returns wrong complexity\nEdit `ROUTES.md` to tune classification rules. The classifier reads this file to determine complexity levels.\n\n### Ollama errors \u002F \"model not found\"\nEnsure Ollama is running and the model is pulled:\n```bash\nollama serve  # Start Ollama if not running\nollama pull qwen2.5:3b\n```\n\n### OAuth token not working\nEnsure your token in `config.yaml` starts with `sk-ant-oat`. The router auto-detects OAuth tokens and adds required identity headers.\n\n### LaunchAgent not starting\nCheck logs and ensure paths are absolute:\n```bash\ncat ~\u002FLibrary\u002FLaunchAgents\u002Fcom.llmrouter.plist  # Verify paths\ncat \u002Fpath\u002Fto\u002Fllmrouter\u002Flogs\u002Fstderr.log  # Check for errors\n```\n",{"name":5,"homepage":46,"metadata":47,"description":7},"https:\u002F\u002Fgithub.com\u002Falexrudloff\u002Fllmrouter",{"openclaw":48},{"os":49,"emoji":51,"homepage":46,"requires":52,"primaryEnv":57},[50,39],"darwin","?",{"bins":53,"anyBins":54},[31],[55,56],"pip","pip3","ANTHROPIC_API_KEY","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Falexrudloff\u002Fllmrouter",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":66,"prompt":76,"zipAvailable":77},[67,70,73],{"tool":68,"command":69},"npx","npx skills add kbarbel640-del\u002Fskills --skill llmrouter",{"tool":71,"command":72},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill llmrouter",{"tool":74,"command":75},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill llmrouter","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Falexrudloff\u002Fllmrouter\u002FSKILL.md",true,[79,85,89,93,97],{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"_meta.json","REFERENCE","参考文档",275,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Falexrudloff\u002Fllmrouter\u002F_meta.json",{"path":86,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Faloha-workflow.md",3846,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FAI-Robotics\u002Fopenvla-oft\u002Freferences\u002Faloha-workflow.md",{"path":90,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fconfig-troubleshooting.md",4010,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FAI-Robotics\u002Fopenvla-oft\u002Freferences\u002Fconfig-troubleshooting.md",{"path":94,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Flibero-workflow.md",3070,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FAI-Robotics\u002Fopenvla-oft\u002Freferences\u002Flibero-workflow.md",{"path":98,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fpaper-and-checkpoints.md",2600,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FAI-Robotics\u002Fopenvla-oft\u002Freferences\u002Fpaper-and-checkpoints.md",[102,131,158,179,185,204],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":113,"publishedAt":41},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[108],{"categoryNo":109,"categoryName":110,"taxonomyType":111,"taxonomyTypeDesc":112},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[114,115,34,116,117,118,119,120,121,122,123,124,125,126,127,128,35,129,130],"crowd prompting","prompting","with","tokens","domain","world","prompts","operations","instructions","text","tool","system","improve","productivity","marketplace","content","ai agents",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":140,"publishedAt":41},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[137],{"categoryNo":138,"categoryName":139,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[141,34,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,120,157],"dilemm ai","arena","analyze","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":167,"publishedAt":41},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[164],{"categoryNo":165,"categoryName":166,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000021","资料检索与研究",[168,169,170,171,172,173,174,116,175,155,157,176,34,177,178],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":180,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":184,"publishedAt":41},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[183],{"categoryNo":165,"categoryName":166,"taxonomyType":20,"taxonomyTypeDesc":21},[171,170,169,168,178,173,174,116,172,155,157,175,176,34,177],{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":41},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[192,193,194,195,196,197,198,39,199,200,201,202,203],"git","summary","git summary","commits","repository","win32","status","contributors","true","quick","get","branches",{"skillNo":205,"name":206,"nameZh":6,"description":207,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":208,"categories":209,"keywords":214,"publishedAt":41},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[210,211],{"categoryNo":138,"categoryName":139,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":212,"categoryName":213,"taxonomyType":111,"taxonomyTypeDesc":112},"01JBSEEDCAT000000000000037","律师与法务",[215,216,217,218,116,219,220,58,221,176,222,223,224,225,226,35,227,228,40],"agent constitution","constitution","contracts","tree","query","base","log","check","Rules","projects","compliance","actions","state","governance"]