Building with AILesson 67 of 80

Module 7 · Safety, security and the adversary

Denial of wallet: attacks on your bill

In this lesson

  • 8 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 7 of 10 in this chapter

This chapter’s goalThreat-model an AI feature and defend it by architecture: name every channel by which untrusted text reaches the model and every channel by which its output reaches a privileged action or the outside world, restrict each with a control that does not depend on the model’s obedience, layer moderation and abstention with measured false-positive costs, and state plainly what a user must be told and what you cannot promise about a provider’s handling of their data.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
One unauthenticated endpoint, one script, one hourInput tokens430Output tokens540Total, from one machine970dollars an hourTen requests a second, 4,000 tokens in and 1,000 out, at $3 and $15 per million. Every request isvalid, so the provider bills all of it. A per-user budget claimed before the call, a bot check at theedge and a kill switch are part of the feature, not operations.
Ten requests a second, 4,000 tokens in and 1,000 out, at $3 and $15 per million. Every request is valid, so the provider bills all of it. A per-user budget claimed before the call, a bot check at the edge and a kill switch are part of the feature, not operations.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

The arithmetic of one script

An endpoint with no authentication that forwards text to a frontier model. An attacker’s script sends ten requests a second, each with a 4,000-token prompt and asking for a 1,000-token reply. Input: 40,000 tokens a second, around $0.12 at $3 per million, which is about $430 an hour. Output: 10,000 tokens a second, around $0.15 at $15 per million, about $540 an hour. Call it a thousand dollars an hour, twenty-four thousand a day, from one machine with no skill required, and the provider will bill you for every token because every request was valid.

This is not hypothetical. Free-tier “try it” boxes on product pages have been discovered by people running scripts within days of launch, and the bill arrives before the discovery.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Python, from Zero, for AI exam.

Stuck on something?Ask Sayali, your AI tutor

How to cite: Addaly (2026) ‘Denial of wallet: attacks on your bill’, in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/denial-of-wallet (Accessed: 29 November 2026).