ClawRouter intelligently routes requests to the most cost-effective LLMs with a seamless wallet system, eliminating the need for API keys. By utilizing over 30 models and achieving payment efficiencies of x402, this open-source tool ensures maximum savings and flexibility in handling AI tasks.
ClawRouter
ClawRouter is an innovative routing tool designed to optimize the costs associated with large language model (LLM) usage, achieving up to 78% savings on inference costs. This powerful solution enables automatic routing of requests to the cheapest model that can fulfill the task, consolidating access to 30+ models through a single wallet without the need for multiple API keys.
Key Features
- Local Decision Making: Using a 14-dimensional weighted scoring system, ClawRouter performs routing decisions entirely on your machine in less than 1 millisecond, eliminating the need for external API calls.
- Cost-Effective Micro-Payments: The integration of USDC micropayments allows users to pay only for the requests they make, significantly lowering costs. ClawRouter supports x402 micropayments, making transactions efficient and straightforward.
- Open Source and Transparent: ClawRouter is fully open source, enabling anyone to inspect its routing logic under the MIT license.
How It Works
ClawRouter utilizes a weighted scoring system to assess each request, determining which model can handle it most effectively. Here’s a brief overview of how routing works:
Request → Weighted Scorer (14 dimensions)
│
├── High confidence → Pick model from tier → Done
│
└── Low confidence → Default to MEDIUM tier → Done
Ambiguous requests default to faster, cost-effective models suitable for the majority of tasks.
Performance
ClawRouter routes requests through four distinctive tiers:
- SIMPLE: Utilizes optimized models like deepseek-chat for basic inquiries at $0.27/M, saving approximately 99% against standard models.
- MEDIUM: Engages models such as gpt-4o-mini at $0.60/M, allowing almost 99% savings compared to premium offerings.
- COMPLEX: Leverages models like claude-sonnet-4 at $15.00/M, ideal for more intricate tasks.
- REASONING: Specifically designed for questions requiring extensive reasoning, utilizing models like o3.
Supported Models
ClawRouter interfaces with a variety of models across major AI providers, including:
- OpenAI (e.g., gpt-4o, gpt-5.2)
- Anthropic (e.g., claude-sonnet-4)
- Google (e.g., gemini-2.5-pro)
- DeepSeek (e.g., deepseek-chat)
- xAI (e.g., grok-3)
Usage Example
Integrating ClawRouter into your application is straightforward. Here’s an example of programmatic usage:
import { startProxy } from "@blockrun/clawrouter";
const proxy = await startProxy({
walletKey: process.env.BLOCKRUN_WALLET_KEY!,
onReady: (port) => console.log(`Proxy on port ${port}`),
onRouted: (d) => console.log(`${d.model} saved ${(d.savings * 100).toFixed(0)}%`),
});
const res = await fetch(`${proxy.baseUrl}/v1/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "blockrun/auto",
messages: [{ role: "user", content: "What is 2+2?" }],
}),
});
This solution provides agents with a seamless means to utilize AI, allowing programmatic interaction with different models based on specific requirements.
For further details, including setup instructions, please visit the documentation. Explore efficient LLM routing and take advantage of significant cost savings with ClawRouter.
No comments yet.
Sign in to be the first to comment.