* feat: add ClawRouter as a provider for cost-optimized model routing 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 #10843 * docs: enhance ClawRouter documentation - Add ClawRouter to providers overview - Expand documentation with: - Model capabilities configuration - Multiple roles setup - Troubleshooting section - Cost monitoring - Comparison with OpenRouter - Complexity dimensions explanation * feat: add ClawRouter to core/llm/llms - Add ClawRouter.ts extending OpenAI base class - Register ClawRouter in llms/index.ts * feat: add User-Agent headers for ClawRouter integration tracking - 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. * feat: complete ClawRouter integration with full provider support - 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 * feat: add ClawRouter to VS Code schema, docs nav, and AI SDK - 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 * docs: add wallet setup and x402 payment documentation - 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 * feat: add premium tier and enhanced ClawRouter features - 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 * test: add ClawRouter unit tests - 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 * docs: add routing profile switching and enhanced error handling docs - 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 * fix: address PR review feedback - move docs to /more, resize logo, add provider constants, fix docs example * fix: replace clawrouter logo with higher-res brand kit version (128x128)
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { LLMOptions } from "../../index.js";
|
|
import { osModelsEditPrompt } from "../templates/edit.js";
|
|
|
|
import OpenAI from "./OpenAI.js";
|
|
|
|
// Get Continue version from package.json at build time
|
|
const CONTINUE_VERSION = process.env.npm_package_version || "unknown";
|
|
|
|
/**
|
|
* ClawRouter LLM Provider
|
|
*
|
|
* 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.
|
|
*
|
|
* Features:
|
|
* - 15-dimension prompt complexity scoring
|
|
* - Automatic model selection (cheap → capable based on task)
|
|
* - OpenAI-compatible API at localhost:1337
|
|
* - Support for multiple routing tiers (auto, free, eco)
|
|
*
|
|
* @see https://github.com/BlockRunAI/ClawRouter
|
|
*/
|
|
class ClawRouter extends OpenAI {
|
|
static providerName = "clawrouter";
|
|
|
|
// ClawRouter can route to models that support reasoning fields
|
|
protected supportsReasoningField = true;
|
|
protected supportsReasoningDetailsField = true;
|
|
|
|
static defaultOptions: Partial<LLMOptions> = {
|
|
apiBase: "http://localhost:1337/v1/",
|
|
model: "blockrun/auto",
|
|
promptTemplates: {
|
|
edit: osModelsEditPrompt,
|
|
},
|
|
useLegacyCompletionsEndpoint: false,
|
|
};
|
|
|
|
/**
|
|
* Override headers to include Continue-specific User-Agent
|
|
* This helps ClawRouter track integration usage and optimize accordingly
|
|
*/
|
|
protected _getHeaders() {
|
|
return {
|
|
...super._getHeaders(),
|
|
"User-Agent": `Continue/${CONTINUE_VERSION}`,
|
|
"X-Continue-Provider": "clawrouter",
|
|
};
|
|
}
|
|
}
|
|
|
|
export default ClawRouter;
|