What problem does it solve? LLM API costs grow quickly in production applications, especially when every request uses the most expensive model, retries fire on permanent errors, and long system prompts are resent on every call. This Skill provides composable patterns for controlling spend without sacrificing quality on complex tasks. ## Core Features & Use Cases - Model Routing by Complexity: Automatically select cheaper models (e.g., Haiku) for simple tasks and reserve expensive models (e.g., Sonnet) for large inputs using configurable thresholds. - Immutable Budget Tracking: Track cumulative spend with frozen dataclasses and enforce budget limits before each API call, failing early instead of overspending. - Narrow Retry Logic: Retry only transient errors (rate limits, connection failures, server errors) with exponential backoff while failing fast on authentication or bad request errors. - Prompt Caching: Cache long system prompts with ephemeral cache control to reduce both cost and latency on repeated requests. - Use Case: When processing a batch of 500 documents through the Claude API, route small documents to Haiku, enforce a $1.00 budget cap, retry only on rate limits, and cache the shared system prompt to cut total spend by 3-4x. ## Quick Start Ask the AI to build a cost-aware LLM pipeline that routes requests between Haiku and Sonnet based on input size, tracks spend against a budget, and retries only transient API errors.