Cost, Latency and Limits
What every model call costs and how long it takes, then caches, rate limits, retries with jitter, fallbacks, circuit breakers and concurrency, built by hand first.
A model call costs money by the token, takes seconds, and can be refused when you send too much too fast. This phase makes those three facts concrete. You will work out the cost of a request, a user and a month with plain arithmetic, see where the seconds go (waiting, reading your prompt, writing the answer), and put guards in place so one bug or one heavy user cannot empty the budget.
Then it builds, step by step and with a simulated clock (a counter in milliseconds, so every example is instant and gives the same output every time), the tools that keep a product running when the provider is slow or refusing: caches that skip repeated calls, a token bucket that respects rate limits, retries with backoff and jitter (the full story of why 100 clients retrying together make things worse), fallback chains, a circuit breaker, and a concurrency limit. Each is built by hand before any library is shown.
Prices in every example are variables with example numbers. Read your provider's price page and keep real prices in configuration. The two real-model labs show the rate-limit headers a live service sends back. The phase ends with a playbook that joins limiter, retry, fallback, cache and cost meter into one resilient client in Python, Java and JavaScript.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.