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 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.
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.
ClawRouter routes requests through four distinctive tiers:
ClawRouter interfaces with a variety of models across major AI providers, including:
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.