What problem does it solve? LLM API spend grows quickly 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 to route tasks across model tiers, enforce budget limits, retry only transient failures, and cache prompts. ## 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 complex ones based on text length and item count thresholds. - Immutable Budget Tracking: Track cumulative spend with frozen dataclasses and fail early when a budget limit is exceeded. - 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 token costs and latency. - Use Case: A batch pipeline processing thousands of documents routes short items to Haiku, long ones to Sonnet, checks a $1.00 budget before each call, and logs every model selection decision for threshold tuning. ## Quick Start Ask the AI to build a cost-aware LLM pipeline that routes requests between Haiku and Sonnet based on task complexity, tracks spend against a budget, retries only transient errors, and caches the system prompt.