Skills for Real Engineers. Straight from my .agents directory.
llm-cost-optimization
Agent skill fromBagelHole/DevOps-Security-Agent-Skills
Reduce LLM API and infrastructure costs through model selection, prompt caching, batching, caching, quantization, and self-hosting strategies. Track spend by team and model, set budgets, and implement cost-aware routing.
How to install llm-cost-optimization
npx skills add BagelHole/DevOps-Security-Agent-Skills# or add only this skill to Claude Code: copy the folder
devops/ai/llm-cost-optimization/
# into
~/.claude/skills/llm-cost-optimization/ (all projects)
.claude/skills/llm-cost-optimization/ (one project)
1# LLM Cost Optimization23Cut LLM costs by 50–90% with the right combination of caching, model selection, prompt optimization, and self-hosting.45## When to Use This Skill67Use this skill when:8- LLM API spend is growing faster than revenue9- You need to attribute AI costs to teams, products, or customers10- Implementing caching to avoid redundant LLM calls11- Deciding when to switch from API providers to self-hosted models12- Optimizing prompt length without sacrificing quality1314## Cost Levers by Impact1516| Strategy | Typical Savings | Effort |17|----------|-----------------|--------|18| Semantic caching | 20–50% | Low |19| Model right-sizing | 30–70% | Low |20| Prompt compression | 10–30% | Medium |21| Provider caching (prompt cache) | 10–25% | Low |22| Batching offline workloads | 50% (Batch API) | Medium |23| Self-hosting 7–8B models | 80–95% at scale | High |24| Quantization | 30–50% VRAM cost | Medium |2526## Track Costs First2728```python29# Use LiteLLM's cost tracking (automatic per-model pricing)30import litellm3132response = litellm.completion(33 model="gpt-4o-mini",34 messages=[{"role": "user", "content": "Hello"}],35)36cost = litellm.completion_cost(response)37print(f"Cost: ${cost:.6f}")3839# Add custom cost callbacks40def log_cost(kwargs, completion_response, start_time, end_time):41 cost = kwargs.get("response_cost", 0)42 model = kwargs.get("model")43 user = kwargs.get("user")44 # Send to your analytics DB45 db.record_cost(user=user, model=model, cost=cost)46…
Excerpt shown under the repository's MIT license.
More skills in DevOps-Security-Agent-Skills
Similar skill repositories
An agentic skills framework & software development methodology that works.
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Public repository for Agent Skills
Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Production-grade engineering skills for AI coding agents.
