← ClaudeAtlas

llm-cost-guardlisted

Review LLM-calling code for token and cost blowups before they hit your bill — a large static prompt prefix re-sent uncached on every call, a frontier model doing a task a cheap one handles, unbounded context or output, per-item calls that should be batched, re-embedding unchanged content, and agent loops with no token budget. Estimates the dominant cost driver, rewrites it, and reports the before/after spend, naming the latency and quality trade-offs. Use whenever writing or reviewing code that calls an LLM or embedding API — Anthropic/Claude, OpenAI, Bedrock, Vertex, or a framework like LangChain/LlamaIndex — a chat endpoint, a RAG pipeline, an agent loop, or a batch job, especially one that runs at volume.
windchillscalanthes-ship-it/llm-cost-guard · ★ 0 · AI & Automation · score 73
Install: claude install-skill windchillscalanthes-ship-it/llm-cost-guard
# LLM Cost Guard Catch the LLM call that quietly multiplies your bill — and rewrite it to cost a fraction, before the invoice arrives. A single innocent-looking pattern (re-sending an 8K-token system prompt on every request without caching, calling a frontier model for a yes/no classification, letting an agent loop with no token ceiling) can turn a $180/month feature into a $2,400/month one. It passes review because it *works* — cost isn't in the diff. This skill reads the code, finds the dominant cost driver, and produces the cheaper rewrite with the spend before and after — while naming the latency and quality trade-offs so the fix is honest. ## When to use this - You are **writing** code that calls an LLM or embedding API and want it checked. - You are **reviewing** a prompt, a RAG pipeline, an agent loop, or a batch job. - The **bill went up** and you want to know which call is driving it. - Someone asks "why is this so expensive?", "can we make this cheaper?", or "should this use a smaller model?". If the feature is low-volume (an internal tool run a few times a day), most of this doesn't matter — say so and don't over-engineer. Cost optimization is worth effort in proportion to **calls × tokens × price**; a prototype nobody hits is not the place for a caching strategy. ## Workflow 1. **Establish context.** Identify the **provider and model(s)** (Anthropic/Claude, OpenAI, Bedrock, Vertex, …), the **call site** (per-request endpoint, batch job, agent loop,