llm-cost-latency-budget
Model the cost and latency of an LLM feature before it ships and surprises the bill. Use when asked to estimate LLM API costs, set a latency/token budget, decide which model tier to use, or bring down the cost of an AI feature. Produces a cost & latency budget — token math per request, monthly cost projection, model tiering, caching/streaming levers, p95 latency targets, and a guardrail/alert plan.
git clone --depth 1 https://github.com/mohitagw15856/pm-claude-skills /tmp/llm-cost-latency-budget && cp -r /tmp/llm-cost-latency-budget/plugins/pm-ai/skills/llm-cost-latency-budget ~/.claude/skills/llm-cost-latency-budgetSKILL.md
# LLM Cost & Latency Budget Skill LLM features have a unit cost and a tail latency that demos hide and production exposes. This skill does the token math up front — what one request costs, what a million cost, where the p95 latency comes from — and lays out the levers (model tiering, caching, prompt trimming) so cost and speed are designed, not discovered. ## Required Inputs Ask for these only if they aren't already provided: - **The request shape** — typical system prompt, user input, retrieved context, and output sizes (in rough tokens). - **Volume** — requests/day now and at target scale; peak concurrency. - **Models in play** — candidate model(s) and their per-token input/output prices. - **Targets** — acceptable cost per request (or per user/month) and the latency users will tolerate (p50 / p95). ## Output Format ### Cost & Latency Budget: [feature] **1. Per-request token math** — a table estimating tokens in/out per call, and the resulting cost at each candidate model's price. | Component | Tokens | $ in | $ out | |---|---|---|---| | System prompt | | | | | Retrieved context | | | | | User input | | | | | Output | | | | | **Per request** | | **$x** | | **2. Monthly projection** — per-request cost × volume, at current and target scale; the headline number leadership will ask for. **3. Model tiering** — route easy requests to a cheaper/faster model and only escalate hard ones (cascade); show the blended cost. Often the single biggest saving. **4. Latency** — where the p95 comes from (model TTFT + output length + retrieval + network), the target, and how **streaming** changes *perceived* latency even when total time is unchanged. **5. Cost levers** — ranked by impact: prompt/context trimming, caching (prompt cache + response cache for repeats), shorter outputs (max_tokens), batching, tiering, and "do you need the model at all for this path." **6. Guardrails** — per-user / per-day rate limits, a max-tokens cap, a spend alert threshold, and a kill switch — so a bug or abuse can't produce a surprise invoice. ## Quality Checks - [ ] Token estimates are itemised (system + context + input + output), not a single guessed number - [ ] The monthly cost is projected at **target** scale, not just today's volume - [ ] Model tiering / cascade is considered before accepting the flagship-model cost everywhere - [ ] p95 (not just average) latency is targeted, and streaming is considered for perceived speed - [ ] Caching is evaluated for repeated prompts/contexts - [ ] A spend alert + rate limit + kill switch are specified to cap the downside ## Anti-Patterns - [ ] Do not budget on average latency — users feel the p95, and the tail is where AI features feel broken - [ ] Do not default every call to the most capable model — most requests don't need it; tiering often cuts cost by more than half - [ ] Do not forget output tokens cost more than input — verbose responses are often the hidden cost driver - [ ] Do not ship without a spend cap and alert — an unbounded LLM feature is an unbounded bill - [ ] Do not optimise cost before measuring it — itemise the real token usage first, then pull the biggest lever ## Based On LLM production cost/latency practice — token accounting, model cascades/tiering, prompt & response caching, and tail-latency budgeting.
Design a 360-degree feedback survey or write a structured 360 feedback report. Use when asked to build a 360 feedback process, write 360 feedback for a colleague, design a feedback survey, or produce a feedback report. Produces either a complete survey instrument with rating scales and open-ended questions, or a structured narrative feedback report with themes, strengths, and development areas.
Decode a 401k or workplace retirement plan — the real cost of its funds, the match's fine print, vesting math, and the plan features worth using or avoiding. Use when someone asks 'is my 401k any good', 'decode my 401k plan', 'which funds should I look at', or 'what fees am I paying'. Produces a fee decode in dollars-over-time, match and vesting math, a fund-lineup triage by cost, and the questions for HR or the plan administrator.
Design statistically rigorous A/B tests for product features, UI changes, onboarding flows, and pricing experiments. Use when asked to set up an experiment, design an A/B test, calculate sample size, or interpret test results. Produces a complete test plan with hypothesis, variant definitions, sample size, duration estimate, guardrail metrics, and a results interpretation guide.
Analyse a finished A/B test and write the readout — the result, whether it's statistically and practically significant, what it means, and the ship/no-ship call. Use when asked to analyse experiment results, write an A/B test readout, interpret test data, or decide whether to ship a variant. Produces a clear verdict with the lift and confidence, segment cuts, the risks (peeking, novelty, sample), and a recommendation. Distinct from planning a test — this reads results.
Generate a WCAG 2.2 accessibility audit checklist and remediation suggestions for any UI or design. Use when asked to audit for accessibility, check WCAG compliance, review a design for a11y issues, or create an accessibility remediation plan. Produces a prioritised checklist with pass/fail assessments and specific fixes.
Plan a trip that actually works with a disability or access need — confirm real accessibility (not just 'accessible' labels), book the assistance in advance, plan for equipment and medication, and build in the contingencies for when access breaks down. Use when someone says 'plan an accessible trip', 'travelling with a wheelchair/disability', 'book assistance for my flight', or 'will this hotel actually work for me'. Produces an access-verified itinerary, an assistance-booking checklist, an equipment/medication plan, and contingency scripts. Verify specifics with providers.
Request a reasonable accommodation at work or in education — frame it around the barrier and the adjustment (not your diagnosis), cite the right process, and navigate the back-and-forth constructively. Use when someone says 'I need a workplace accommodation', 'request reasonable adjustments', 'ADA/Equality Act accommodation', or 'how do I ask for accommodations for my disability/condition'. Produces the request letter, a barriers-and-adjustments map, disclosure guidance, and a plan for the interactive process. Not legal advice — routes to the formal process and to advocacy where needed.
Build a structured account plan for any key customer or target account. Use when asked to create an account plan, key account strategy, strategic account review, or territory plan. Produces a complete account plan with relationship map, growth opportunities, risks, and 90-day action plan.