Agent Skillsmohitagw15856/pm-claude-skills › llm-cost-latency-budget

llm-cost-latency-budget

GitHub

在LLM功能上线前估算API成本与延迟,通过token数学计算、模型分层、缓存策略及流式传输优化,生成包含月度成本预测、p95延迟目标和防超支护栏的预算方案。

plugins/pm-ai/skills/llm-cost-latency-budget/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

估算LLM API成本 设置延迟或Token预算 决定使用哪种模型层级 降低AI功能的成本

Install

npx skills add mohitagw15856/pm-claude-skills --skill llm-cost-latency-budget -g -y
More Options

Non-standard path

npx skills add https://github.com/mohitagw15856/pm-claude-skills/tree/main/plugins/pm-ai/skills/llm-cost-latency-budget -g -y

Use without installing

npx skills use mohitagw15856/pm-claude-skills@llm-cost-latency-budget

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill llm-cost-latency-budget -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "llm-cost-latency-budget",
    "description": "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."
}

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.

Version History

  • a38bc30 Current 2026-07-05 11:10

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md
exports/openclaw/brief-builder/SKILL.md
exports/openclaw/briefing-note/SKILL.md
exports/openclaw/budget-builder/SKILL.md
exports/openclaw/budget-variance-analysis/SKILL.md
exports/openclaw/bug-diagnosis/SKILL.md
exports/openclaw/bug-report/SKILL.md

Metadata

Files
0
Version
471c606
Hash
a52addb5
Indexed
2026-07-05 11:10

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-30 11:16
浙ICP备14020137号-1 $방문자$