Study the lesson
Work through every section at your own pace, from start to finish.
You have built something that works. Users are happy, the model responses are good, and then the invoice arrives. Or worse: your application grinds to a halt at 9 in the morning on a Monday with a wall of HTTP 429 errors and no obvious explanation. Both problems have the same root cause: most developers learn enough about large language model APIs to get a prototype running, and then discover the billing and throttling mechanics only when something breaks in production. This lesson untangles those mechanics. Rate limits and spend quotas are different things, controlled by different levers, and they are routinely confused at considerable cost. Token pricing has a structure that rewards deliberate prompt design, and a toolkit of techniques (caching, batching, and model routing) can meaningfully reduce what you pay without degrading what your users experience. By the end you will be able to read a provider's pricing page with confidence, diagnose throttling errors correctly, and make informed decisions about when to call a frontier model and when a smaller one will do.
Unlock the full lesson, the quiz, and your verifiable completion.
Continue with GoogleBy continuing you agree to the Institute of AI terms of use and privacy policy.
None of these are hard requirements. The lesson is easier if they are already familiar, but everything it uses is explained along the way, so you can start without them.
Section one is open to everyone. Create a free account to work through the rest and take the quiz.
Developers frequently conflate two distinct constraints, and treating them as the same thing leads to debugging in the wrong place. Rate limits are throughput constraints: they govern how fast you can consume an API, typically expressed as tokens per minute, requests per minute, or tokens per day. When you exceed a rate limit, the API responds with an HTTP 429 status code, defined as too many requests; the server is not saying your account is out of funds, it is saying you are sending traffic faster than your tier permits. Spend quotas are volume or budget caps, which may appear as a monthly token ceiling or a hard spend limit in your billing console. Exhausting a quota surfaces differently per provider: some return a distinct account-level error, while others reuse HTTP 429 with a specific error code such as insufficient_quota, so read the error body rather than the status code alone; either way, it is not resolved by slowing your request rate. You can hit a rate limit with budget to spare, and you can exhaust a quota while sending requests well within your per-minute limit, so diagnosing which problem you have is the first step to fixing it. Why do rate limits exist? The short answer is fairness. LLM inference is GPU-bound, and a single large, sustained workload can starve other users sharing the same infrastructure, so rate limits ensure fair allocation across thousands of concurrent tenants and protect overall system stability. Higher-tier plans carry higher limits because the provider has planned for that capacity; the limit is a ceiling on how fast you may send, not a guaranteed level of throughput. Think of it like motorway smart lanes, where variable speed limits keep finite road capacity flowing for everyone. The standard way to handle 429 errors is exponential backoff with jitter. When a 429 is received, wait before retrying, and increase the wait time with each successive failure. Adding randomness, the jitter, to the delay prevents a thundering herd: if every client retries at the same interval, they all hit the API simultaneously and trigger another 429. Most provider SDKs include built-in retry logic, so verify it is enabled before writing your own.
Work through every section at your own pace, from start to finish.
A short set of questions on what you have just covered.
Every completion has a certificate that you can share publicly for anyone to verify.
Pass the quiz and the Institute of AI issues you a record of completion with your score. Every completion has its own public verification page, so the link you put on your CV or LinkedIn profile can be checked by anyone, at any time.
Free lessons, a quiz to test what you have learned, and a completion you can verify publicly. All from the UK's professional body for artificial intelligence.
Every AI lesson is free to start, free to finish, and ends in a completion you can verify publicly.