· 11 min read ·
What the AI assistant on this site costs, and its 1 dollar daily cap

Summary
The AI assistant on this site answers a short question with Claude Haiku 5.5 for about $0.00012 on average, so 1 dollar covers roughly 8,200 questions. Even the longest and most expensive request the site accepts stays under $0.002. If the day's spend reaches 1 dollar, the assistant closes for the rest of that day. In its first three days it received 19 requests and spent $0.0068 in total.
There is an AI assistant in the bottom right corner of this site. Visitors ask it what Cahit does, which projects he has built and how he works. When I opened it up, the first thing I thought about was the bill. A public chat box can turn into something that burns money every day in the wrong hands.
So I put a 1 dollar cap on the assistant’s daily spend. This post uses measured numbers to show how much is actually spent under that cap, what one question costs and how the cap is protected.
How the assistant works
The assistant runs on Cloudflare Workers and uses Claude Haiku 5.5, Anthropic’s smallest and cheapest model. It costs $0.10 per million input tokens and $0.50 per million output tokens.
Every request sends the model the same long instruction text. It holds the assistant’s rules and the facts published on the site: services, projects, experience and contact details. The assistant answers only from these facts, gives no prices or dates and stays out of private life. This instruction text is 5,762 tokens. A visitor’s question averages 18 characters, which is 20 to 30 tokens.
So most of every request is the instruction text, and it is identical every time. That is where the cost is decided.
What caching changes
Anthropic’s API can keep the unchanged beginning of a request in a cache for 5 minutes. Text read from the cache is billed at one tenth of the normal price. Writing it to the cache the first time costs 25 percent more than the normal price.
In the assistant, one marker is enough:
system: [{ type: 'text', text: SYSTEM_PROMPT, cache_control: { type: 'ephemeral' } }],
The instruction text contains nothing that changes per request, such as the date, the time or the page language. The page language is added separately, as a short note at the end of the conversation. That keeps the first 5,754 tokens identical for every visitor, so they can be read from the cache.
To see the effect, a small measurement script was written that uses the assistant’s exact prompt, model and limits. It sent made-up short questions, a six-question conversation and the longest request the site accepts to the real API, and recorded the billed tokens. The whole measurement cost $0.0037.
| Case | Input | Cache read | Cache write | Output | Cost |
|---|---|---|---|---|---|
| First short question (cold cache) | 30 | 0 | 5,754 | 131 | $0.00079 |
| Short question, warm cache (average of 5) | 27 | 5,754 | 0 | 121 | $0.00012 |
| Whole six-question conversation | 3,538 | 34,524 | 0 | 1,030 | $0.0012 |
| Longest request the site accepts | 8,725 | 5,754 | 0 | 368 | $0.0011 |
With a warm cache a short question costs $0.00012, so 1 dollar covers about 8,200 questions. Without caching, the whole instruction text would be billed at the normal price and each question would cost about $0.00064. In this assistant, caching cuts the cost to a fifth.
Caching also changes where the money goes. Even though 97.5 percent of a question’s tokens are instruction text, half of the cost now goes to the answer, because output tokens cost five times as much as input and cached input is billed at a tenth. That is why the assistant’s “usually 1 to 3 sentences” rule also lowers the cost directly.
Responses stay fast too. In the measurement the first word of the answer arrived after 0.66 seconds on average.
Caching has a price at low traffic
Caching has one condition: the entry is dropped after 5 minutes. This is not a high-traffic site. When more than 5 minutes pass between two questions, the next one writes the cache again and costs $0.00079. That is slightly more than the $0.00064 it would cost with no caching at all.
The math still favours caching. The extra cost of writing the instruction text to the cache is about $0.00014. A single second question within the same 5 minutes saves $0.00052. So if the chance of a second question within 5 minutes is above 28 percent, the cache pays for itself. Visitors usually ask more than one question in a conversation, so that bar is easy to clear.
The site’s real records show the same thing. In the first three days 19 requests came in and $0.0068 was spent in total. That is $0.00036 per request on average, higher than the warm-cache $0.00012 because some requests found the cache cold. These numbers also include test requests made before the site went live.
The layers that protect the cap
A 1 dollar daily cap is just a rule. The real work is making sure nobody with bad intentions can reach it easily. The assistant has four layers.
1. Bot check. On the first question of a conversation, Cloudflare Turnstile checks whether the visitor is a human. A visitor who passes gets a signed session token valid for 30 minutes. That way the check does not repeat on every question, and a request without a valid token never reaches the model.
2. Per-visitor limit. A visitor can ask at most 5 questions a minute and 20 a day. Visitors are recognised by IP address, but the address is not stored. It is mixed with a secret value that changes every day and hashed, so the same visitor’s records on two different days cannot be linked. The counters are deleted after two days. In the first three days the most questions one visitor asked in a minute was 3, and in a day 9; nobody came near the limits.
3. Per-request limit. A conversation can have at most 12 messages. A visitor message can be at most 500 characters and an earlier assistant answer at most 2,500. The assistant’s answer is capped at 700 tokens. These limits decide how much the most expensive request can cost.
4. Daily total cap. Before every request the day’s total spend is checked. If it has reached 1 dollar, the model is not called and the visitor is told the assistant is closed for the day. Spend is calculated from the token counts Anthropic returns with each answer and written to a Cloudflare D1 database. Fractions are always rounded up, so the spend is never under-counted.
if ((perMinute.results[0]?.count ?? 0) > LIMITS.perMinute) return { ok: false, reason: 'rate_minute' };
if ((perDay.results[0]?.count ?? 0) > LIMITS.perDay) return { ok: false, reason: 'rate_day' };
if ((spend.results[0]?.micro_usd ?? 0) >= dailyBudgetUsd * 1_000_000) return { ok: false, reason: 'budget' };
The counters are incremented before the model is called. A rejected request still counts, and a burst of simultaneous requests cannot slip past the limit together.
How long 1 dollar lasts in the worst case
The longest request measured, with all 12 messages at their character limits, cost $0.0011. In that request the model wrote a 368-token answer. On paper there is something worse: a request that finds the cache cold and whose answer runs all the way to the 700-token cap. By calculation it costs $0.0019.
Even in that worst case, 1 dollar covers about 515 requests. Since one visitor can ask at most 20 questions a day, filling the daily cap would take at least 26 different visitors who have passed the bot check and spend their whole daily allowance on the most expensive requests. If that happens, the loss is at most 1 dollar and the assistant opens again by itself the next day.
The cap has one known gap. Spend is written after the answer finishes, so a few requests in flight at the same time may have passed the check before the cap was reached. Each costs at most $0.002, so the overshoot stays within a few cents.
What this means for companies
The cost of a public AI assistant often depends less on the model’s price than on the size of the text sent again with every request. In this assistant that text is about 200 times the size of a question. Without caching, most of the money goes to the same text every time.
For any public AI feature, three things should be decided up front: the most one request can cost, the most requests one person can send in a day, and where the daily total stops. Once those three are set, the bill for the worst possible day can be calculated in advance.
Limits
The measurement was taken on 25 November 2026 with that day’s instruction text and prices. The numbers shift a little as the instruction text changes. The real traffic figures cover the first three days and are very small; as traffic grows, the cache will stay warm more often and the average cost per request should fall. No visitor question or answer was used in this post, only totals.
I prepared the code and the measurements with Claude Code. The full results, with token counts and timings for every request, are in the JSON file.
FAQ
- If someone abuses the assistant on purpose, can the bill grow?
- No. Before every request the day's total spend is checked, and once it reaches 1 dollar the model is not called at all. A few requests already in flight can push past the cap by a few cents at most. A single visitor can also ask at most 20 questions a day.
- Does prompt caching always lower the cost?
- Only while the cache stays warm. The first write costs 25 percent more than the normal price and the entry lives for 5 minutes. If a second question arrives in that window the cache more than pays for itself; if not, that request costs a little more than it would without caching.
- Were visitors' questions used in this post?
- No. The post uses only totals: how many requests came in, how much was spent, how many conversations there were. The questions in the measurement were made up for it.
Comments
No comments yet. Be the first to write one.