LLM API Cost Optimization SOP: Prefix Caching, Model Routing, and Batch API
A six-step SOP for cutting LLM API costs: quantify baseline, prefix caching (Qwen3.8-Max charges ¥1/M on cache hit vs ¥12 on miss, a 12x gap), model routing (expensive models for hard tasks, cheap for easy), batch API (latency for discount), context trimming with dedup, and monitoring. Each step ships with Python code, pitfalls, and FAQ.