What problem does it solve? LLM API costs grow quickly when every request uses the most expensive model, retries fire on permanent errors, and long system prompts are resent uncached. This Skill provides composable Python patterns to control spend while preserving quality on complex tasks. ## Core Features & Use Cases - Model Routing by Complexity: Automatically selects cheaper models (e.g., Haiku) for simple inputs and reserves expensive models (e.g., Sonnet) for large texts or high item counts. - Immutable Cost Tracking: Tracks cumulative spend with frozen dataclasses and enforces pre-flight budget checks before each API call. - Narrow Retry Logic and Prompt Caching: Retries only transient errors (rate limits, connection, server errors) with exponential backoff, and caches long system prompts via cache_control. - Use Case: When batch-processing hundreds of documents through the Claude API, route each item to the right model tier, reject requests that would exceed a $1.00 budget, and log per-interaction costs to a JSONL metrics file via the included PostToolUse hook. ## Quick Start Ask the AI to build a cost-aware LLM pipeline that routes requests between Haiku and Sonnet based on input size, enforces a budget limit, and caches the system prompt.