feat: add ClawRouter as a provider for cost-optimized model routing#11751
feat: add ClawRouter as a provider for cost-optimized model routing#11751RomneyDa merged 13 commits intocontinuedev:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
No issues found across 7 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Updated PR SummaryWhy This Matters for Continue UsersProblem: Users frequently hit cost and credit issues with LLM providers:
Solution: ClawRouter provides automatic, intelligent model routing:
How It WorksClawRouter uses a 15-dimension prompt complexity scoring system:
Latest Updates
Quick Start for Reviewers# Terminal 1: Start ClawRouter
npx clawrouter
# Terminal 2: Test the endpoint
curl http://localhost:1337/v1/modelsHappy to address any feedback! |
9b01176 to
72059f5
Compare
|
I have read the CLA Document and I hereby sign the CLA |
72059f5 to
cf29d1f
Compare
|
recheck |
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 on blended inference costs. Changes: - Add ClawRouterApi class extending OpenAI adapter - Add 'clawrouter' provider to the type system - Add ClawRouter models (auto, free, eco) - Add ClawRouter provider config with UI setup - Add ClawRouter logo - Add documentation (clawrouter.mdx) Closes continuedev#10843
- Add ClawRouter to providers overview - Expand documentation with: - Model capabilities configuration - Multiple roles setup - Troubleshooting section - Cost monitoring - Comparison with OpenRouter - Complexity dimensions explanation
- Add ClawRouter.ts extending OpenAI base class - Register ClawRouter in llms/index.ts
- Add 'User-Agent: Continue/IDE' header to identify Continue requests - Add 'X-Continue-Provider: clawrouter' header for routing analytics - Enhanced documentation with features list This helps ClawRouter optimize routing decisions based on integration source and enables better analytics for the Continue community.
cf29d1f to
c3d983b
Compare
|
recheck |
- Add clawrouter to PROVIDER_HANDLES_TEMPLATING (autodetect.ts) - Add clawrouter to PROVIDER_SUPPORTS_IMAGES (autodetect.ts) - Add clawrouter tool support function (toolSupport.ts) - Add supportsReasoningField and supportsReasoningDetailsField - Add promptTemplates with osModelsEditPrompt - Match OpenRouter implementation patterns
- Add clawrouter to VS Code config_schema.json provider enum - Add ClawRouter description in config_schema.json - Add clawrouter to docs.json navigation (top-level providers) - Add clawrouter to AI SDK PROVIDER_MAP
- Add Wallet & Payment Setup section to clawrouter.mdx - Document payment tiers (free/eco/auto) - Add wallet funding instructions (Solana/Base USDC) - Add spend control configuration - Update VS Code schema description with wallet info - Update provider longDescription with payment options
- Add blockrun/premium routing profile (mission-critical tasks) - Add dual-chain wallet support docs (Base EVM + Solana) - Add model exclusion documentation - Update routing profiles table with savings percentages - Update comparison table with auth/payment differences - Total 44+ models, 4 routing tiers
- Add ClawRouter.vitest.ts (core/llm/llms) - Provider name verification - Default options validation - Reasoning field support - User-Agent header verification - Routing profiles acceptance - Add ClawRouter.test.ts (openai-adapters) - Default apiBase - Custom apiBase override - Continue headers - OpenAI standard headers - Add clawrouter tests to toolSupport.test.ts - blockrun/* routing profiles - Tool-supporting model patterns
Additional Context: Related Issues This PR Helps AddressClawRouter's automatic routing and fallback capabilities can help address several open issues: Rate Limiting (429 errors)
Payment Required (402 errors)
ClawRouter uses USDC micropayments via x402 protocol — wallet-based authentication means no API key management, and automatic payment handling prevents 402 errors. How ClawRouter Addresses TheseThe 15-dimension routing also helps prevent these issues proactively by:
Users experiencing these issues today can use |
- Add 'Switching Between Routing Profiles' section with full examples - Add /model command tip for quick switching - Add 'Error Handling' section comparing Continue vs ClawRouter - Document automatic error recovery (429, 402, 500+, timeout) - Add response header documentation for diagnostics - Add AI-powered doctor command for troubleshooting
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/customize/model-providers/top-level/clawrouter.mdx">
<violation number="1" location="docs/customize/model-providers/top-level/clawrouter.mdx:184">
P2: JSON profile-switching example is inconsistent with the section guidance because it omits the `blockrun/free` profile present in YAML.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
RomneyDa
left a comment
There was a problem hiding this comment.
- Need to add to PROVIDER_HANDLES_TEMPLATING, PROVIDER_SUPPORTS_IMAGES, etc if applicable
and see comments, can merge with requested changes!
There was a problem hiding this comment.
This icon is too large, could you make it a small PNG icon?
There was a problem hiding this comment.
Done! Resized to 64x64 (1.6KB), matching other provider logos in the directory.
|
Also note merge conflicts |
…d provider constants, fix docs example
|
@RomneyDa All requested changes addressed:
Let me know if anything else needs updating! |
RomneyDa
left a comment
There was a problem hiding this comment.
The icon still looks funky although size issue is fixed, could you address?
1bcMax
left a comment
There was a problem hiding this comment.
Replaced the logo with our official brand kit version (128x128, higher resolution). Should look clean now — let me know if it works!
Summary
Add ClawRouter as a new provider option in Continue. ClawRouter is an open-source LLM router that automatically selects the cheapest capable model for each request based on prompt complexity.
Why
Users frequently hit cost and provider issues with Continue (e.g., #10298 OpenRouter 402 errors, general model selection friction). ClawRouter addresses this by:
localhost:1337Changes
packages/openai-adapters/src/apis/ClawRouter.ts— API adapter extending OpenAIpackages/openai-adapters/src/index.ts— Register clawrouter providerpackages/openai-adapters/src/types.ts— Add clawrouter to provider type uniongui/src/pages/AddNewModel/configs/models.ts— Add ClawRouter models (auto, free, eco)gui/src/pages/AddNewModel/configs/providers.ts— Add ClawRouter provider configgui/public/logos/clawrouter.png— Provider logodocs/customize/model-providers/top-level/clawrouter.mdx— DocumentationTesting
Related
Closes #10843
Disclosure: I maintain ClawRouter.
Summary by cubic
Adds
clawrouteras a provider for automatic, cost‑optimized model routing via a local OpenAI‑compatible API. Includes four routing tiers, UI/docs wiring, analytics headers, tests, and post‑review fixes (docs moved to/more, logo resized, examples corrected).New Features
ClawRouter(extendsOpenAI) with defaults (apiBasehttp://localhost:1337/v1/, modelblockrun/auto), reasoning fields, edit prompt, and registration inLLMClasses.ClawRouterApi,constructLlmApicase,AiSdkprovider map; sendsUser-Agent: Continue/<version|IDE>andX-Continue-Provider: clawrouter.PROVIDER_TOOL_SUPPORTfor routed models and common patterns; provider enums/constants updated (VS Code schema).blockrun/auto,blockrun/free,blockrun/eco,blockrun/premium), updated logo, docs at/customize/model-providers/more/clawrouter(setup, tiers, wallet/x402, switching, error handling, cost monitoring, OpenRouter comparison).ClawRouterandClawRouterApiheaders/config, plus tool support tests.clawrouterpresets.Migration
npx clawrouter(serves athttp://localhost:1337), then add a ClawRouter preset or set a customapiBase.blockrun/freewithout payment; fund the auto‑created wallet forblockrun/eco,blockrun/auto, andblockrun/premium.Written for commit c108797. Summary will update on new commits.