Install
$ agentstack add skill-droodotfoo-agent-skills-llm-cost-optimizer ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
LLM Cost Optimizer
Reduce LLM API costs systematically without sacrificing output quality.
Three Modes
1. Cost Audit
Assess current spend and find the 80/20 opportunities.
- Instrument -- Add token counting and cost tracking per request. Log model, input tokens, output tokens, latency, and use case.
- Find 80/20 -- Identify which 20% of use cases drive 80% of cost. Sort by total spend, not per-request cost.
- Classify -- Tag each use case by complexity: simple (classification, extraction), medium (summarization, Q&A), complex (reasoning, code generation, multi-step).
2. Optimize Existing
Apply techniques to reduce cost on current workloads.
- Routing -- Route simple tasks to cheaper/smaller models. See optimization-techniques.md.
- Caching -- Cache repeated or similar queries. Prompt caching for system prompts.
- Compression -- Reduce prompt size without losing quality. Trim examples, remove redundancy.
3. Design Cost-Efficient
Build new systems with cost awareness from day one.
- Budget envelopes -- Set per-feature monthly cost budgets. Alert at 80%.
- Routing layer -- Default to cheapest model that meets quality bar. Escalate on failure.
- Observability -- Track cost per user, per feature, per model. Dashboard with trends.
Optimization Order
Apply techniques in this order (highest impact first):
- Model routing (60-80% reduction potential)
- Prompt caching (40-90% on cached portions)
- Output length control (20-40%)
- Prompt compression (15-30%)
- Semantic caching (30-60% hit rate)
- Request batching (10-25%)
See [optimization-techniques.md](./optimization-techniques.md) for detailed guidance on each technique.
What You Get
- A cost audit identifying which use cases drive the majority of LLM spend, with per-request and total cost breakdowns.
- Prioritized optimization recommendations (model routing, caching, compression) ranked by reduction potential.
- Concrete implementation steps with expected cost savings percentages for each technique.
Rules
- Never optimize before measuring -- instrument first
- Never sacrifice quality silently -- A/B test every change
- Cost per request is misleading -- optimize total spend per outcome
- The cheapest token is the one you never send
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: DROOdotFOO
- Source: DROOdotFOO/agent-skills
- License: MIT
- Homepage: https://droo.foo/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.