Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 6 of 39
❮Prev Next❯

Quotas, Rate Limits, Scaling and Cost

Module 1: Plan & Manage ⏱ 10 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    Quota is tokens per minute (TPM) for each model, deployment type and region in a subscription. Each deployment takes a slice of it, and requests per minute (RPM) come with the slice (about 6 RPM per 1,000 TPM for OpenAI models). Go past the limit and the service answers HTTP 429 with a retry-after header. Handle it with exponential backoff and retry, split load across deployments or regions, use Provisioned throughput for steady load with spillover to a standard deployment for peaks, and control spend with token budgets, cost alerts, smaller models, shorter prompts and caching.

    Simulate it » No Azure account needed

    Exam objective: 1.3.1 Manage quotas, scaling, rate limits and cost footprints for model and agent workloads. (Skills measured as of April 16, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Manage quota, rate limits and cost Read quota, resize a deployment and set a token budget.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Open <strong>Operate ➜ Quota</strong>. Quota belongs to the <strong>subscription</strong>, per <strong>region</strong>, per <strong>model</strong>, per <strong>deployment type</strong>, in <strong>tokens per minute</strong>. Each deployment takes a slice.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Open Operate ➜ Quota. Quota belongs to the subscription, per region, per model, per deployment type, in tokens per minute. Each deployment takes a slice.
    2. Traffic grew, and clients see 429 Too Many Requests. Raise the deployment's TPM from 50K to 120K. RPM rises with it (for older chat models, 6 RPM per 1,000 TPM).
    3. The 429 spike lines up with lunchtime. Retries smooth short bursts; steady growth needs more TPM or a provisioned deployment.
    4. For steady, latency-sensitive traffic, buy provisioned throughput units (PTUs) and turn on spillover so peaks go to the standard deployment instead of failing.
    5. Now cap the spend. Search for Cost Management and open Budgets.
    6. Type budgets in the search bar and pick Cost Management under Services.
    7. A budget warns, it doesn't stop anything. Set it on the resource group or filter to the Foundry resource.
    8. Alert at 80% actual and 100% forecast. Pair it with smaller models, prompt caching and Batch for overnight jobs to bring the number down.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    At lunchtime the chatbot returns 429 errors, and at month end the bill doubles.

    😊 THE SOLUTION

    Size TPM, retry politely, add provisioned throughput with spillover and set budgets.

    • HTTP 429 at peak✓ More TPM, or retry-after with backoff
    • Steady high volume✓ PTUs with spillover
    • Runaway spend✓ Budgets and project cost controls
    🛠️ Solved with: Quota, rate limits and cost controls

    Start with a question

    Why do users see errors at noon when the app was fine all morning?

    The support bot runs on a deployment with 10K tokens per minute, which is about 60 requests a minute. At 9 AM traffic is light. At noon every branch opens at once, the app sends 300 requests a minute, and 240 of them come back with 429 Too Many Requests.

    Nothing is broken. The deployment is doing what it was configured to do. The job is to decide whether to wait, to add capacity, or to send the overflow somewhere else.

    Explain it like I’m 10

    The technical explanation

    Quota and the slice per deployment

    Quota is assigned per subscription, per region, per model and deployment type, in thousands of tokens per minute. When you create a deployment you choose its TPM, and that comes out of the quota. The matching RPM is about 6 per 1,000 TPM for OpenAI models.

    • Portal: Foundry portal → Quota (or Azure portal → Foundry resource → Quotas) shows used and remaining per model and region. Request more with the quota request form.
    • CLI: az cognitiveservices usage list --location eastus.

    Deployments share quota. A new deployment shrinks what’s left, and deleting one releases it.

    When you exceed the limit

    The endpoint returns 429 with a retry-after header. Handle it in the client:

    import random, time
    from openai import RateLimitError
    
    def call_with_backoff(fn, tries=6):
        for n in range(tries):
            try:
                return fn()
            except RateLimitError as e:
                wait = float(e.response.headers.get("retry-after", 2 ** n)) + random.random()
                time.sleep(wait)
        raise RuntimeError("Still throttled after retries")

    The Azure SDKs and the OpenAI client already retry a few times. Tune them, and don’t add loops that retry instantly.

    Scale options

    OptionUse it when
    Increase the deployment’s TPMYou have spare quota and the load is persistent
    Request more quotaThe subscription’s quota is the limit
    Another deployment or regionQuota is exhausted in one region. Load balance in the app or with a gateway such as Azure API Management
    Provisioned throughput (PTU)Steady high volume that needs predictable latency
    SpilloverA provisioned deployment is full. Overflow goes to a standard deployment instead of failing
    BatchThe work can wait up to 24 hours

    Control cost

    1. Measure: token counts in Azure Monitor per deployment, and Cost analysis for the resource group.
    2. Choose smaller models for easy tasks (previous lesson).
    3. Trim the prompt: shorter system messages, fewer retrieved chunks, summaries of long history.
    4. Cache: repeated prompt prefixes can be cached by the service.
    5. Budget and alert: set an Azure budget with alerts at, say, 80%, and a project-level token limit where available. Tags on resources show which team spent what.
    Architect level Why sizing PTUs for the peak is a trap

    Provisioned throughput is billed for the capacity you reserve, used or not. If the peak is three times the base load, reserving for the peak means you pay for two thirds of it to sit idle most of the day. Size PTUs for the steady base and let spillover handle the peaks on pay-per-token capacity. Re-check the split every month, because both lines move.

    Real-world business scenario

    Retail

    Contoso Retail (fictional)

    The problem
    Every lunchtime promotion pushed the shopping assistant into 429 errors, and the monthly bill was a surprise.
    What they used
    Client retry with exponential backoff and jitter, a provisioned deployment sized for the steady base with spillover to a Global Standard deployment, prompt caching for the long product policy prefix, and a budget with alerts at 80% and 100%.
    Why that choice
    Backoff absorbed short bursts, provisioned throughput gave steady latency, spillover covered promotions, and alerts showed the trend before the invoice did.
    The result
    Errors during promotions stopped, and the finance team could see token spend by team every week.

    When to use it and when not to

    ✓ Use it when…

    • Load is steady and high, so reserved capacity pays off (provisioned).
    • Peaks are short and can overflow to pay-per-token (spillover).
    • Several teams share a subscription and need budgets and tags.

    ✕ Think twice when…

    • You retry in a tight loop without backoff.
    • You size provisioned capacity for the peak.
    • You leave unused deployments holding quota.

    ↔ Alternatives to consider

    • Azure API Management as a gateway to balance across deployments and regions.
    • Global Batch for work that can wait.
    • A smaller model when the task allows it.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AI-103 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    A client receives intermittent HTTP 429 responses with a retry-after header from a model deployment. What should the client do first?

    Question 2

    Question 2 of 5

    Quota for a model is assigned at which level?

    Question 3

    Question 3 of 5

    An app has a steady base load that needs predictable latency, with short peaks that are three times higher. Failed requests during peaks are unacceptable.

    Which design is most cost effective?

    Question 4

    Question 4 of 5

    A project must warn the team at 80 percent of its monthly spend and be visible by team. What should you configure?

    Question 5

    Question 5 of 5

    Which change reduces input token cost when every request begins with the same long policy text?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner What does an HTTP 429 from a model endpoint mean?

    Model answer

    I've gone over the tokens-per-minute or requests-per-minute limit for that deployment. The retry-after header says how long to wait. The fix is to back off and retry, or to give the deployment more capacity.

    Intermediate How do you split quota between deployments?

    Model answer

    Quota is per subscription, model, deployment type and region. Each deployment gets a slice of it, so giving one deployment more leaves less for others. I'd give production the larger slice, keep a small one for tests, and delete unused deployments to release quota.

    Experienced developer When would you choose provisioned throughput with spillover?

    Model answer

    When the base load is steady and high enough that reserved PTUs are cheaper than pay-per-token, and the app needs steady latency. I size the PTUs for the base load, not the peak, and enable spillover so peak requests go to a standard deployment instead of failing.

    Scenario Costs doubled after a feature launch and nobody knows why. What do you check?

    Model answer

    Token metrics per deployment and per project in Azure Monitor and cost analysis, to find which deployment grew. Then the prompts: long system messages, large retrieved context, and loops of tool calls. I'd cut context, cache the stable prefix, move easy tasks to a smaller model, and set a token budget with alerts so the next jump is seen early.

    Quick revision

    Key points

    • Quota is TPM per model, deployment type and region. Deployments take slices of it.
    • RPM comes with the TPM slice. Exceeding either gives HTTP 429.
    • Handle 429 with retry-after, exponential backoff and jitter.
    • Provisioned throughput gives steady latency, and spillover sends peak overflow to a standard deployment.
    • Control cost with budgets and alerts, smaller models, shorter context and caching.

    Important terminology

    Quota
    The tokens-per-minute allowance a subscription has for a model and deployment type in a region. Deployments are carved out of it.
    TPM and RPM
    Tokens per minute and requests per minute. A deployment has both limits, and a request is throttled when either is exceeded.
    HTTP 429
    The status a Foundry endpoint returns when you exceed a rate limit. The retry-after header says how long to wait.
    Exponential backoff
    A retry pattern that waits longer after each failed attempt, often with random jitter, so clients don't all retry at once.
    Spillover
    A setting that sends overflow requests from a full provisioned deployment to a standard deployment instead of returning 429.
    Prompt caching
    Reusing the processed beginning of a prompt that repeats between requests, which lowers latency and the cost of the repeated input tokens.

    Common mistakes

    • Retrying instantly in a tight loop, which makes throttling worse.
    • Sizing provisioned capacity for the peak and paying for idle PTUs.
    • Leaving test deployments running, so they hold quota.

    Exam tips

    • "Requests fail with 429 at peak" = backoff and retry, more capacity, or spillover.
    • "Steady, high volume, predictable latency" = Provisioned.
    • "Stop unexpected spend" = budget and alerts.
    • "Lower cost per request without changing the model" = shorter prompts and caching.

    Five quick revision questions

    1. 1.What does the retry-after header tell you?Show

      How many seconds to wait before retrying.

    2. 2.What is quota measured in?Show

      Tokens per minute.

    3. 3.What does spillover do?Show

      Sends overflow from a provisioned deployment to a standard deployment.

    4. 4.Which limits can trigger a 429?Show

      Either tokens per minute or requests per minute.

    5. 5.Which retry pattern avoids retry storms?Show

      Exponential backoff with jitter.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Monitor Models, Agents and Search Indexes

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.