Agent skill · data analytics · borghei
llm-cost-optimizer
This skill should be used when the user asks to "estimate LLM costs", "count tokens in prompts", "optimize prompt token usage", "compare model pricing", or "reduce LLM API costs".
Why this skill is useful
Adds specific scripts for token counting and prompt optimization that the AI wouldn't reliably generate on its own.
What it needs
Requires python installed locally. About 2k tokens when loaded. Last updated 2026-07-21. 462 stars on the source repository.
What this skill does
LLM Cost Optimizer Category: Engineering Domain: AI Cost Management Overview The LLM Cost Optimizer skill provides tools for counting tokens, estimating costs across different LLM providers, and optimizing prompts to reduce token usage without sacrificing quality. Essential for teams managing LLM API budgets at scale. Clarify First Before estimating or optimizing, confirm these inputs. If any is unknown or vague, ASK — do not assume: [ ] Input prompt/text — the prompt file or text to count or optimize (the input via --file/--text/--stdin) [ ] Target models — which models to estimate cost for (sets --models and the pricing comparison) [ ] Goal — cost estimation vs prompt optimization, and any target reduction (selects tokencounter.py vs promptoptimizer.py and sets --target-reduction) Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact. Quick Start Tools Overview Tool Purpose Key Flags ------ --------- ----------- tokencounter.py Count tokens and estimate costs across models --file, --text, --stdin, --models promptoptimizer.py Analyze prompts for token reduction opportunities --file, --target-reduction, --format cachesavingscalculator.py Model prompt-cache economics: naive vs cached cost, break-even reuse, % savings --requests, --cached-tokens, --cache-write-multiplier, --cache-read-multiplier, --base-input-price, --json Workflows Cost Estimation for New Project 1. Collect sample prompts (system prompt + user messages) 2. Run tokencounter.py with target models 3. Multiply per-request cost by expected daily volume 4. Compare models on cost-quality tradeoff Prompt Optimization Sprint 1. Identify highest-cost prompts from usage logs 2. Run promptoptimizer.py on each 3. Apply suggested optimizations 4. Re-count tokens to verify reduction 5. A/B test optimized vs. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills borghei/llm-cost-optimizer