llm-cost-optimization
LLM Cost Optimization
Evaluate LLM cost reductions through caching, model selection, prompt optimization and self-hosting; measure quality and total cost before claiming savings.
When to Use This Skill
Use this skill when:
- LLM API spend is growing faster than revenue
- You need to attribute AI costs to teams, products, or customers
- Implementing caching to avoid redundant LLM calls
- Deciding when to switch from API providers to self-hosted models
- Optimizing prompt length without sacrificing quality
Estimates and cache boundaries
All savings ranges, model IDs and prices below are historical illustrations, not current quotes or guaranteed outcomes. Verify provider pricing, cache-write/read charges, minimum prefixes and batch availability for the chosen model. Use an approved budget/data scope before paid calls or uploads. The semantic cache is a toy: namespace keys by tenant, authorization scope, model/version, system prompt and generation settings, enforce retention and never reuse a similar answer across users or for permission-sensitive/fresh data. Replace blocking Redis KEYS with a bounded index/SCAN or vector query; handle expired entries and zero vectors. The sample is not production-ready.