LLM Cost Optimizer
Use proactively whenever LLM API costs come up -- or should.
Before & after
Same prompt, same agent — the only difference is the skill.
That's a significant budget. There are definitely ways to optimize that spend. First, I'd want to understand where the costs are coming from—which models are you using, what's your usage pattern, how many tokens per request? Are there specific workflows that are particularly expensive? You might benefit from model selection strategy, prompt caching, or batch processing. It really depends on your architecture. Tell me more about what you're building, and I can suggest some approaches to bring that down.
LLM COST OPTIMIZATION ANALYSIS Current spend: 5,000 USD/month | Target: 2,000 USD/month (60% reduction) COST BREAKDOWN • Claude Opus (50%): 2,500 USD/month → 500M input tokens, 50M output tokens → Avg cost per request: 2.15 USD (high complexity tasks) • Claude Sonnet (30%): 1,500 USD/month → 800M input tokens, 100M output tokens → Avg cost per request: 0.42 USD (standard tasks) • GPT-4 (20%): 1,000 USD/month → Legacy integrations, planned retirement OPTIMIZATION #1: Model Downgrade (20% savings) • Analysis: 40% of Opus requests are for routine summarization (complexity score <3) • Action: Route summary tasks to Sonnet (4x cheaper, similar quality) • Implementation: Adjust routing logic in middleware • Estimated savings: 1,000 USD/month OPTIMIZATION #2: Prompt Caching (25% savings) • Finding: System prompts are 8KB each, repeated in 70% of requests • Action: Implement prompt cache with Anthropic API v1.11+ • Setup: Cache policy TLL = 5 min, Markdown formatting (5KB cache per prompt) • Estimated savings: 1,250 USD/month OPTIMIZATION #3: Batch Processing (15% savings) • Finding: Reports and exports run nightly, wait < 12 hours for results • Action: Use batch API (50% discount) instead of streaming • Setup: Queue generation jobs, submit at 2am UTC, retrieve at 10am • Estimated savings: 750 USD/month OPTIMIZATION #4: Max Tokens Enforcement (10% savings) • Finding: No max_tokens limit, some outputs run 8KB (wasting budget) • Action: Set max_tokens=1000 for summary tasks, 2000 for content • Implementation: Default in all API calls • Estimated savings: 500 USD/month IMPLEMENTATION ROADMAP • Week 1: Deploy model routing (Sonnet for summaries) • Week 2: Enable prompt caching • Week 3: Batch API setup (reports, exports) • Week 4: Max tokens enforcement EXPECTED OUTCOME: 2,100-2,200 USD/month (56% reduction)
About this skill
name: llm-cost-optimizer description: Use when Use proactively whenever LLM API costs come up -- or should.
Llm Cost Optimizer
Use proactively whenever LLM API costs come up -- or should. Triggers include: 'my AI costs are too high', 'optimize token usage', 'which model should I use', 'LLM spend is out of control', 'implement prompt caching', 'we're about to launch an AI feature', 'build me an AI endpoint'. Don't wait for an explicit cost complaint -- if someone is building an AI feature, designing an LLM endpoint, or choosing between models, cost architecture belongs in the conversation. Apply immediately when any of these are true: a system prompt appears that exceeds a few hundred tokens, all requests are hitting the same model, max_tokens is not set, or no per-feature cost logging exists. NOT for RAG pipeline design (use rag-architect). NOT for improving prompt quality or effectiveness (use senior-prompt-engineer).
What you get
- Public GitHub repo (alirezarezvani/claude-skills)
- the llm-cost-optimizer skill folder with SKILL.md. Part of a 337-skill / 30-agent / 70-command install.
Customize your output
- Fork the repo and adapt the skill's instructions and references to your workflow.
Example output
Activates automatically when your request matches Llm Cost Optimizer; chains with the other skills, agents, and commands in the collection.
Best for
Creators, builders, and teams using Claude Code.
SKILL.md preview
---
name: llm-cost-optimizer
description: Use this skill proactively whenever LLM API costs come up, an AI feature is being designed, or a model choice is being made, even before an explicit cost complaint.
version: 1.0.0
category: Development / Engineering
author: AgentVolt
license: proprietary
tags:
- development
- engineering
---
# Llm Cost Optimizer
Applies cost architecture to LLM-backed features: model selection, prompt caching, token budgeting, and per-feature cost visibility, before spend becomes a problem.
## When to use
… (sign up to view the full skill)Featured in
More development skills
View all Development skills →Generate
Scaffold code, tests, and boilerplate from a short spec.
Performance Profiler
Systematic performance profiling for Node.js, Python, and Go applications.
Threat Detection
Use when hunting for threats in an environment, analyzing IOCs, or detecting behavioral anomalies in telemetry.
Agent Harness
Turns a domain folder of skills into a bounded agentic loop: compile a goal into a task plan, execute with the domain's tools, verify every task, retry within a budget.