ClawRouter is an open-source LLM router that automatically selects the cheapest capable model for each request based on prompt complexity, providing 78-96% cost savings.
Installation
ClawRouter runs locally and provides an OpenAI-compatible API:http://localhost:1337.
You can also install it globally:
Configuration
- YAML
- JSON (Deprecated)
config.yaml
Available Models
ClawRouter provides four routing profiles:
You can also specify any of the 44+ models directly (e.g.,
anthropic/claude-sonnet-4.6, openai/gpt-5.4, xai/grok-4).
How It Works
ClawRouter uses a 15-dimension prompt complexity scoring system to analyze each request:- Simple requests (greetings, basic Q&A, simple edits) → routed to cheap models like Claude Haiku or Gemini Flash
- Medium requests (code explanations, refactoring) → routed to balanced models like Claude Sonnet or GPT-4o-mini
- Complex requests (architecture design, complex debugging) → routed to capable models like Claude Opus or GPT-4o
Complexity Dimensions
The router analyzes prompts across dimensions including:- Code complexity and language detection
- Reasoning depth required
- Context length and dependencies
- Domain expertise needed
- Output format requirements
Model Capabilities
ClawRouter supports function calling and tool use through its underlying model providers. Capabilities are automatically inherited from the routed model.- YAML
- JSON (Deprecated)
config.yaml
Switching Between Routing Profiles
Add multiple ClawRouter profiles to your config and switch via Continue’s model picker:- YAML
- JSON (Deprecated)
config.yaml
Custom API Base
If you’re running ClawRouter on a different port or host:- YAML
- JSON (Deprecated)
config.yaml
Using Multiple Roles
You can configure ClawRouter for different Continue roles:- YAML
- JSON (Deprecated)
config.yaml
API Keys
ClawRouter manages upstream provider API keys internally. You configure them in ClawRouter, not in Continue. For self-hosted setups with custom authentication:- YAML
- JSON (Deprecated)
config.yaml
Wallet & Payment Setup
ClawRouter supports crypto-native payments via the x402 protocol. On first run, ClawRouter automatically generates a wallet:Payment Options
Funding Your Wallet
ClawRouter supports both Solana and EVM wallets:Spend Controls
Set daily/monthly spending limits:Error Handling
ClawRouter handles common LLM errors automatically at the router level:Automatic Error Recovery
Response Headers
ClawRouter adds diagnostic headers to every response:Troubleshooting
Connection Refused
If you see connection errors, make sure ClawRouter is running:Model Not Found
If a specific model isn’t available, check that ClawRouter has the required provider API keys configured. Runclawrouter --help for configuration options.
Slow Responses
ClawRouter adds minimal latency (~10-50ms) for routing decisions. If responses are slow, the issue is likely with the upstream provider. Try a different model tier (blockrun/eco vs blockrun/auto).
AI-Powered Diagnostics
Run the doctor command for AI-analyzed troubleshooting:Cost Monitoring
ClawRouter provides cost tracking via response headers:x-clawrouter-cost— Cost of the requestx-clawrouter-model— Model that handled the requestx-clawrouter-complexity— Computed complexity score
Dual-Chain Wallet Support
ClawRouter supports payments on two chains from a single wallet:
Switch chains via CLI:
Model Exclusion
Block specific models from routing:Comparison with OpenRouter
ClawRouter can be used alongside OpenRouter — route complex tasks through ClawRouter while using OpenRouter for specific model access.