feat: add ClawRouter provider + fix out-of-credits dialog API key guidance#11955
feat: add ClawRouter provider + fix out-of-credits dialog API key guidance#119551bcMax wants to merge 15 commits intocontinuedev:mainfrom
Conversation
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.
- 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
- 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
…d provider constants, fix docs example
When users hit a 402 from continue-proxy, the dialog previously only offered "Purchase Credits". Now it also surfaces an "Add API key secret" button and explains how to switch to the direct `anthropic` provider, fixing the loop described in issue continuedev#11952. Also adds component tests for OutOfCreditsDialog and StreamErrorDialog covering the 402/out-of-credits routing, customErrorMessage display, and standard status code error branches.
|
Hey @sestinj @Patrick-Erichsen — just wanted to flag that we (@1bcMax) are committed to maintaining the code we've contributed here long-term. That includes the ClawRouter provider, the error handling improvements, and any related tests. If anything we've shipped causes issues down the line — regressions, conflicts with new features, or anything else — please tag us and we'll handle it promptly. We're here to stay as reliable contributors, not just one-time submitters. 🙏 |
There was a problem hiding this comment.
1 issue found across 21 files
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="gui/src/pages/AddNewModel/configs/models.ts">
<violation number="1" location="gui/src/pages/AddNewModel/configs/models.ts:2695">
P2: `clawrouterPremium` is incorrectly flagged as open-source despite routing to proprietary models.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }, | ||
| icon: "clawrouter.png", | ||
| providerOptions: ["clawrouter"], | ||
| isOpenSource: true, |
There was a problem hiding this comment.
P2: clawrouterPremium is incorrectly flagged as open-source despite routing to proprietary models.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At gui/src/pages/AddNewModel/configs/models.ts, line 2695:
<comment>`clawrouterPremium` is incorrectly flagged as open-source despite routing to proprietary models.</comment>
<file context>
@@ -2679,6 +2679,61 @@ export const models: { [key: string]: ModelPackage } = {
+ },
+ icon: "clawrouter.png",
+ providerOptions: ["clawrouter"],
+ isOpenSource: true,
+ },
+ clawrouterFree: {
</file context>
| isOpenSource: true, | |
| isOpenSource: false, |
|
Hey @RomneyDa — thanks again for merging our previous PR (#11751)! Wanted to loop you in on this follow-up as well. We're committed to maintaining all the code we've contributed long-term — ClawRouter provider, error handling improvements, and related tests. If anything causes issues down the line, tag us and we'll handle it promptly. 🙏 |
Summary
continue-proxy, they now see both a "Purchase Credits" option and an "Add API key secret" button with instructions to switch to the directanthropicproviderStreamErrorDialognow matches both the legacy"You're out of credits!"and the current"You have no credits remaining on your Continue account"stringserrorAnalysisfor non-proxy providers (e.g. DeepSeek insufficient balance)OutOfCreditsDialogandStreamErrorDialogTest plan
errorAnalysis,OutOfCreditsDialog,StreamErrorDialog)continue-proxytoanthropicwith own API key resolves 402Closes #11952
🤖 Generated with Claude Code
Summary by cubic
Adds
clawrouteras a new provider for automatic, cost-optimized model routing (OpenAI-compatible API at http://localhost:1337/v1/). Fixes the out-of-credits flow by showing purchase and API key options and handling generic 402s, resolving the loop in #11952.New Features
clawrouterprovider with defaultapiBasehttp://localhost:1337/v1/, routing profiles (blockrun/auto,blockrun/eco,blockrun/premium,blockrun/free), reasoning/tool support, and Continue headers.llms, autodetect, tool support),openai-adapters/AiSdk, VS Code schema, GUI model presets, and docs.Bug Fixes
anthropic; matches legacy and current copy.OutOfCreditsDialog,StreamErrorDialog, andclawrouteradapter/class.Written for commit 266f984. Summary will update on new commits.