Snippy 如何透過智能路由降低 Claude 使用成本
Snippy
Snippy 透過本地 Ollama 模型,將 Claude 任務路由至合適的子模型,並可把任務拆分成並行子任務,以降低成本及加快執行。用戶可編輯路由方案;獲批的子任務會以無狀態、單次 Claude 呼叫執行,結果再加入主要對話以維持提示詞快取效率。Snippy 會追蹤使用較便宜子模型、重用快取前綴及本地路由所節省或避免的成本。
Snippy
Snippy orchestrates Anthropic's Claude to cut cost by intelligently routing tasks to the most efficient sub-models.
Features
Intelligent Routing: Uses a local Ollama model to determine the optimal Claude sub-model for each task
Cost Optimization:
Downshift savings: Using cheaper models for subtasks
Cache reuse: Leveraging prompt caching to reduce costs
Free routing: Avoiding expensive API calls with local routing
Parallel Processing: Subtasks run in parallel for faster execution
Prompt Cache Preservation: Maintains Claude's prompt cache efficiency
Visual Feedback: Savings tracking in the status bar and collapsible panel
**
How It Works
**
User selects a main Claude model per session
For each task, a local Ollama router proposes a plan:
Which Claude sub-models to use
Whether to split into parallel subtasks
User can edit the proposed plan
Approved subtasks run as stateless, one-shot Claude calls
Results are appended to the main conversation to maintain cache efficiency
Savings are tracked and displayed
Setup
Install the Snippy extension
Configure your Anthropic API key via "Snippy: Set API Key"
Set up Ollama locally with a router model (default: llama3.2:3b)
Select your main Claude model in settings
Savings Tracking
Snippy tracks three buckets:
Downshift Savings: Cost reduction from using cheaper sub-models
Prompt Cache Reuse: Savings from reusing cached prefixes
Free Local Routing: Cost avoided by using local Ollama instead of API calls
**
Configuration
**
snippy.mainModel: Main Claude model for the session
snippy.maxTokens: Maximum tokens for Claude responses
snippy.enablePromptCache: Enable prompt cache optimization
snippy.ollama.baseUrl: Base URL for Ollama server
snippy.ollama.routerModel: Ollama model for routing
來源:DEV Community · dev.to