/vibe:skill-cost-patternsfrom vibe
Decision framework for optimizing LLM costs with caching strategies, rate limiting, model routing, and budget controls. Use when reducing API spend or scaling LLM usage.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When building an LLM application that needs to control costs, apply this decision framework.
Optimize immediately when:
Do not optimize yet when:
Use when: temperature=0, identical prompts repeat, deterministic outputs needed.
key = sha256(json.dumps({"model": m, "messages": msgs, "temp": 0}))
Skip when: temperature > 0, every query is unique, real-time data needed.
Use when: users ask the same question in different words, FAQ-heavy products, customer support.
Threshold guidelines:
Skip when: every query has unique context (code generation), responses must reflect latest data, query space is unbounded.
Use when: system prompt > 1,024 tokens (OpenAI) or model-specific minimum, same prefix sent repeatedly.
| Provider | Action | Savings |
|---|---|---|
| Anthropic | Add cache_control: {"type": "ephemeral"} to system message | 90% on cached prefix (after 25% write premium) |
| OpenAI | Nothing (automatic) | 50% on cached prefix |
| Use Context Caching API with explicit TTL | ~75% on cached context |
Skip when: system prompt changes per request, prompt is under minimum length.
simple: <= 5 words OR matches FAQ keywords -> gpt-4o-mini ($0.15/$0.60)
medium: general queries, summaries -> claude-sonnet ($3/$15)
complex: "analyze", "compare", "debug" -> gpt-4o ($2.50/$10)
Embed 50-100 labeled queries per category. Classify new queries by nearest neighbor.
Train a small classifier (logistic regression or small BERT) on historical query/model pairs.
| Tier | Bucket Size | Refill Rate | Max RPM | Daily Cap |
|---|---|---|---|---|
| Free | 50K tokens | 500/sec | 10 | 50K |
| Pro | 500K tokens | 5K/sec | 60 | 500K |
| Enterprise | 5M tokens | 50K/sec | 300 | 5M |
Retry-After header with rejection responses| Threshold | Action | Reversible |
|---|---|---|
| 70% of monthly budget | Log warning, alert team via Slack/PagerDuty | Yes (auto) |
| 85% of monthly budget | Route all traffic to cheapest model | Yes (auto, next billing cycle) |
| 95% of monthly budget | Serve cached responses only, reject new LLM calls | Yes (manual reset or next cycle) |
Track cumulative cost per user. Flag users exceeding 10x the median. Common causes:
Log every API call with these fields:
{
"timestamp": "2026-04-02T10:30:00Z",
"model": "gpt-4o",
"input_tokens": 1523,
"output_tokens": 487,
"cached_input_tokens": 1024,
"latency_ms": 1847,
"cost_usd": 0.006142,
"user_id": "user_abc123",
"cache_status": "partial_hit",
"request_category": "customer_support",
"complexity_class": "medium",
"routed_from": "gpt-4o"
}
| Mistake | Why it hurts | Fix |
|---|---|---|
| Caching with temperature > 0 | Non-deterministic outputs, stale cache gives wrong variety | Only cache temp=0 calls, or accept that cached responses lose randomness |
| Semantic cache threshold too low | Returns wrong answers for superficially similar queries | Start at 0.95, lower only after measuring false positive rate |
| No cache invalidation | Responses go stale when underlying data changes | Set TTL (1 hour for dynamic data, 24 hours for static), invalidate on data updates |
| Routing all traffic to cheapest model | Quality drops, users notice | Route by complexity, measure quality per tier, set minimum quality thresholds |
| No per-user limits | One abusive user burns entire budget | Always implement per-user quotas, even if generous |
| Ignoring output tokens | Output costs 2-5x more than input per token | Set max_tokens appropriately, use stop sequences, compress outputs |
| Caching before prompt is stable | Cache fills with responses from old prompts | Only enable caching after prompt is finalized, flush cache on prompt changes |
| Model | Input ($/1M) | Output ($/1M) | Cached Input ($/1M) | Best For |
|---|---|---|---|---|
| gpt-4.1-nano | $0.10 | $0.40 | $0.025 | High-volume simple tasks |
| gpt-4o-mini | $0.15 | $0.60 | $0.075 | Simple routing, classification |
| gemini-2.5-flash | $0.15 | $0.60 | $0.0375 | Budget multimodal |
| claude-haiku-3.5 | $0.80 | $4.00 | $0.08 | Fast mid-tier tasks |
| o4-mini | $1.10 | $4.40 | $0.275 | Reasoning on a budget |
| gemini-2.5-pro | $1.25 | $10.00 | $0.3125 | Long context, multimodal |
| gpt-4o | $2.50 | $10.00 | $1.25 | General purpose, function calling |
| claude-sonnet-4 | $3.00 | $15.00 | $0.30 | Balanced quality/cost |
| claude-opus-4 | $15.00 | $75.00 | $1.50 | Maximum quality, complex reasoning |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job