Step-by-step answer
Stretch 45 min6 stepsLog rate-limit headers and cache usage
A capped 20-call logger built on the Anthropic SDK's raw-response API, which records rate-limit headers and cache usage per call, a plot of input-tokens-remaining, and a local fake provider that meters cache-aware ITPM and sends Anthropic's headers. It runs unchanged on OpenRouter, on Ollama or against the fake.
Back to the exercise