llm-cost-and-latency-optimization
LLM Cost and Latency Optimization
Purpose
LLM API cost and response latency scale with tokens processed and number of model calls — both of which are almost always higher than necessary in a first working version of an agent, because it's easier to build without budgeting either. Left unaddressed, this shows up as a surprising bill at scale, or an agent that feels sluggish enough that users stop trusting it to be interactive. Unlike raw model-quality tuning, most of the levers here are structural and don't require changing which model you use at all: reducing redundant context, caching stable prompt prefixes, choosing the right model per step rather than the strongest model for everything, and parallelizing or streaming where the task allows it. This skill treats cost and latency together because most fixes affect both, though not always in the same direction.