Skip to main content
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.
Get started with ClawRouter on GitHub

Installation

ClawRouter runs locally and provides an OpenAI-compatible API:
This starts the router at http://localhost:1337. You can also install it globally:

Configuration

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
This automatic routing provides significant cost savings while maintaining quality for complex tasks.

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.
config.yaml

Switching Between Routing Profiles

Add multiple ClawRouter profiles to your config and switch via Continue’s model picker:
config.yaml
Use the model picker dropdown in Continue’s chat panel to switch between profiles. Each profile routes to different model tiers based on cost vs. quality trade-offs.
Quick switch via CLI: In the Continue chat, type /model followed by the profile name (e.g., /model ClawRouter Eco).

Custom API Base

If you’re running ClawRouter on a different port or host:
config.yaml

Using Multiple Roles

You can configure ClawRouter for different Continue roles:
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:
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:
Fund your wallet with USDC on Solana or Base for the lowest fees. ClawRouter uses the x402 Payment Required protocol for seamless micropayments.
Start with blockrun/free tier to test without payment, then upgrade to blockrun/auto for full model access.

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:
When a fallback occurs:

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. Run clawrouter --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:
The doctor collects system info, wallet status, network connectivity, and sends to Claude for analysis.

Cost Monitoring

ClawRouter provides cost tracking via response headers:
  • x-clawrouter-cost — Cost of the request
  • x-clawrouter-model — Model that handled the request
  • x-clawrouter-complexity — Computed complexity score
You can view aggregated costs with:

Dual-Chain Wallet Support

ClawRouter supports payments on two chains from a single wallet: Switch chains via CLI:
Both wallets are derived from the same BIP-39 mnemonic generated on first run.

Model Exclusion

Block specific models from routing:
Useful when a model doesn’t follow instructions well or you want to control costs.

Comparison with OpenRouter

ClawRouter can be used alongside OpenRouter — route complex tasks through ClawRouter while using OpenRouter for specific model access.