esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is Unbounded Consumption?

What unbounded consumption is, why one user can run up a huge model bill, and how to cap cost in code, explained simply for your AI interview.

In short

Unbounded consumption is when an AI app allows excessive, uncontrolled model use, so one user, a bug or an attacker can run up a huge bill or slow the service for everyone. The cost side is called denial of wallet, and the fix is hard limits on tokens, spend and agent steps, enforced in code or by the provider.

12 min readIntermediateCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Unbounded consumption is when an AI app lets one user, a bug or an attacker trigger so much model use that the bill explodes or the service slows for everyone. People call the cost side denial of wallet. Every request costs real money, and a small prompt can start a long chain of work. OWASP ranks it sixth in its 2026 list. I'd stop it with hard token and spend caps, per-user quotas and agent step limits, enforced in code or by the provider. A request rate limit helps, but it is not enough alone.

What is unbounded consumption, in plain words?

A model is paid for by use. Every request costs money, and the cost grows with the size of the prompt and the length of the answer. Unbounded consumption is when an AI app lets requests run with no real limit on that cost. OWASP describes it as an app that allows excessive and uncontrolled inferences, where an inference is one run of the model on a prompt.

Picture a hospital's supplies team that orders from a supplier billing per item, with no order limit. One broken reorder script sends ten thousand gauze packs before lunch, and the invoice is the first anyone hears of it. A support chatbot that re-reads a 100-page policy manual on every customer message has the same weak spot, and nobody sees the cost until the invoice arrives.

The attack on the money has a name: denial of wallet. The aim is to drain the budget. The service may even keep working while the money runs out.

Key words

Inference
One run of the model on a prompt. You pay for each one.
Token
A small piece of text the model reads or writes. Bills count tokens.
Denial of wallet
An attack that runs up the bill until the owner stops it.
Quota
An allowance for one user, one key or one team.
Circuit breaker
A switch that stops a run once it goes past a set limit.

How does a small prompt become a big bill?

The core idea is cost asymmetry. OWASP says attackers can "trigger disproportionately expensive computation at negligible cost to themselves". The attacker pays little, and the owner pays for every token.

  • “By initiating a high volume of operations, attackers exploit the cost-per-use model of cloud-based AI services, leading to unsustainable financial burdens on the provider and risking financial ruin.”

    OWASP, LLM06:2026

Three routes are common. First, floods of big inputs, such as long documents sent again and again. Second, long thinking: a short prompt can keep a reasoning model busy. That is a model that works through hidden steps before it answers, and input checks miss it because the prompt looks harmless. Third, agents that call tools in a loop, so one message turns into hundreds of calls.

How one small prompt keeps the meter running

One small prompt

a few words, with a task that has no end

Agent

picks the next step itself

Tool call

a search, a lookup, an email draft

Bill climbs

every turn is paid for

  1. 1The small prompt reaches the agent.
  2. 2The agent asks for a tool, such as a search.
  3. 3The result goes back, and the agent asks for the next step.
  4. 4Each tool result leads to another model turn, and every turn is billed.
A small prompt reaches an agent. The agent calls a tool, the result goes back, and the loop repeats. Each turn is billed, and nothing in the loop caps how many turns run.

A worked example: a call centre runs an AI helper that drafts replies for 400 agents. Every call goes through the call centre's own gateway, and each app has its own gateway key. Its prompts include a 100,000-token policy manual. One leaked gateway key sends a request every 20 seconds, far below a usual requests-per-minute limit. Over an hour that is 180 requests, about 18 million tokens, from one key. Anthropic also limits input tokens per minute, and this key sends 300,000 a minute, so a real tier may throttle it before the gateway cap does.

With a cap of 5 million tokens an hour per gateway key, the 51st request is refused about 17 minutes in, after the key has used 5 million tokens. A leaked provider key skips the gateway, so the provider's monthly spend limit is the backstop for that case. The team revokes the key and sees the spike in its cost report.

Why isn't a request rate limit enough?

  • Request rate limit

    Counts requests

    Lets through a set number of requests each second, whatever each one costs. A few huge requests pass as easily as many small ones.

  • Token and spend caps

    Counts cost

    Stops calls once the hour's tokens or the month's spend reach the limit. The check runs in code before the call.

  • “Traditional request-rate limiting alone is no longer sufficient.”

    OWASP, LLM06:2026

  • “These must be enforcement mechanisms that halt inference when exceeded, rather than alerting thresholds that fast-accumulating workloads can outpace.”

    OWASP, LLM06:2026

OWASP's 2026 entry asks for limits on tokens per minute, tokens per day and estimated cost per request, not only requests per second. A cap that only sends an alert leaves the bill running while the alert is read.

What stops the bill, and in what order?

Layers work best. Each one stops a different kind of run, and together they keep the cost inside a set amount. The checks run in code or at the provider, before any model call, so a clever prompt cannot change them.

Checks in code before the model is called

Requests from one key

a leaked key, or a bad loop

Checked in order

Token cap per hour

refuses calls past the hour's limit

Per-user quota

one user cannot use the whole budget

Steps per agent run

counts steps inside one run

Runs within limits

only then the model is called

  1. 1The request enters the first check, the hourly token cap.
  2. 2A call under the cap moves on to the user's quota.
  3. 3Then the step count for the run is checked.
  4. 4Only calls that pass every check reach the model.
Two checks in code run before each model call, and a step limit stops a run that loops. Any check can refuse a call, and a refused call never reaches the model.
  1. 1

    Cap tokens in code

    Estimate the tokens before each call and refuse anything over the limit. OWASP: "Use pre-flight token estimation to reject requests before inference begins."

  2. 2

    Set a hard spend cap

    Set a monthly limit that the provider enforces. Anthropic's documentation says: "When usage reaches a spend limit you set, requests return HTTP 400 with error type invalid_request_error."

  3. 3

    Give each user a quota

    One account should not use the whole team's budget. OWASP: "Set non-overridable budget ceilings per API key, user, team, and cloud account."

  4. 4

    Limit agent runs

    Every agent run gets a step limit, a depth limit and a time limit. OWASP: "Enforce step limits, recursion depth limits, time limits, and per-run cost ceilings on all agent executions." That is a circuit breaker: a hard stop on each run.

  5. 5

    Watch cost per user

    Log tokens and cost per user, and check for spikes. Alerts warn. Caps stop.

Here is the call centre's guard in plain Python. The limits and the key are made up, and the code only counts tokens. It does not call a model.

Python
# The call centre's gateway counts tokens as well as requests.
HOUR_TOKEN_CAP = 5_000_000   # hard cap for one gateway key, per hour (made-up)
MAX_REQUESTS_PER_SECOND = 5  # a usual request-rate limit (made-up)

def guard(used_tokens, new_tokens, requests_per_second):
    if requests_per_second > MAX_REQUESTS_PER_SECOND:
        return "STOPPED: too many requests a second"
    if used_tokens + new_tokens > HOUR_TOKEN_CAP:
        return "STOPPED: hourly token cap reached"
    return "OK"

used = 0
# A leaked gateway key sends one 100,000-token document every 20 seconds.
for request in range(1, 61):
    verdict = guard(used, 100_000, 1 / 20)
    if verdict != "OK":
        print("Request", request, verdict)
        break
    used += 100_000
print("Tokens used this hour:", used)

Output

Request 51 STOPPED: hourly token cap reached
Tokens used this hour: 5000000

Tip

Asked how to stop a runaway bill? Name the cap, say it is enforced in code or by the provider, and say what the user sees when it trips.

How would you set a budget for a new AI feature?

Say a company wants a document chatbot for 2,000 staff, billed per token. I'd start with the expected tokens per person per day, then set a per-user daily cap in code, a monthly spend cap in the provider's console, and a step limit for any agent that searches. After two weeks of real use, I'd check the numbers and tighten the caps.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: anyone who can trigger model use can run up the cost or slow the service.
  • Denial of wallet, and why a small prompt can cost a lot.
  • Why a request rate limit alone falls short: size counts as well as the number of calls.
  • Hard caps in code that stop calls, not only alerts.
  • Agent loops: step, depth and time limits so a run is forced to stop.
  • Where it sits in OWASP: LLM06 in the 2026 list, LLM10 in 2025.

Common traps

  • Trap"Rate limiting handles it."

    BetterIt is a request-count limit, so it misses cost. Add token and spend caps as well.

  • Trap"A billing alert will stop the spend."

    BetterAn alert tells you. A cap that code or the provider enforces stops the spend.

  • Trap"Only attackers cause this."

    BetterA retry loop or an agent with no step limit can burn the budget on its own.

Can you spot the cost risk?

Spot the cost risk

Which setup has no real limit on what a run can cost?

Quick check

One leaked gateway key is draining the budget. Which limit caps how much damage that key can do?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q206Name the OWASP LLM Top 10 (2026).10 min
  2. Q207What changed from the 2025 list to the 2026 list?Coming soon
  3. Q208What is the OWASP Agentic Top 10?11 min
  4. Q330How do you handle rate limits and 429 errors?Coming soon
  5. Q187How do you control agent cost?13 min

Last updated on 26 November 2026

Building an AI feature that many people will call?

I design and build AI products and agents, including the limits that keep usage and cost under control. Book a short call and tell me what you are building and how many people will use it.