AI cost report for roomGPT
We found 5 ways your app could run up an AI bill. 3 have no ceiling: anyone could run up your bill without limit.
- 3Fix now
- 2Fix soon
Checked 1 AI call in your app. Its model is not named in the code (it comes from a setting or a variable), so no dollar figures are shown. Only the built-in checks ran. Claude Code, Codex or Gemini CLI, when installed, also reviews the code. On a subscription this costs nothing extra; with an API key it uses your API credits.
What to fix most urgent first
- Fix now
Nothing caps how much your app can spend on AI
- What could happen
- If something goes wrong, like a loop, a burst of traffic or someone abusing a page, the app keeps paying for AI calls until you notice the bill.
- What it could cost
No ceiling
Nothing limits how often this runs, and each request is billed by your provider.
- How to fix it
Add a daily spending limit per user and for the whole app, and stop calling the AI once it is reached.
Paste it into your AI coding tool.
More details
- Where
app/generate/route.ts:40- Found by
- The built-in check "No spending cap". IntentiAI is confident about this.
- In technical terms
- No dollar/token budget guard or circuit breaker found anywhere; LLM spend is unbounded.
- Why it costs money
- A runaway loop, retry storm, or traffic spike keeps calling the API with nothing to halt spend. 1 AI call is exposed.
- Technical fix
- Add a per-run token/dollar budget that halts LLM calls when exceeded.
- Research
- When Agents Do Not Stop: Uncovering Infinite Agentic Loops in LLM Agents (arXiv:2607.01641): Cost exhaustion is a core agentic-loop harm; a spend guard is the backstop.
- Fix prompt
- My app has no spending limit on AI calls. Near the code that calls the AI, starting with app/generate/route.ts (around line 40), add a daily limit per user and an overall daily limit (count tokens or requests from each response), and refuse further AI calls with a clear message once a limit is reached. Make the limits easy to change in one place. Keep everything else working the same, and tell me what you changed.
- Fix now
Your rate limit switches off when a setting is missing
- What could happen
- The limit only works when certain settings are filled in. On a new deploy or a preview where they are missing, anyone can call the AI as often as they like.
- What it could cost
No ceiling
- How to fix it
Make the app refuse to serve the AI feature when the limit is not set up, instead of skipping it.
Paste it into your AI coding tool.
More details
- Where
app/generate/route.ts:8- Found by
- The built-in check "Rate limit that depends on a setting".
- In technical terms
- The spend/abuse guard is constructed only when its env vars are set, and the request path skips it when they are not. The default deployment is unguarded.
- Why it costs money
- Whether anything limits spend depends on deployment configuration, not on this code. If the env vars are missing (a fresh deploy, a preview environment, a fork), every request reaches the paid call with no quota, which is a Denial-of-Wallet opening on a public endpoint.
- Technical fix
- Fail closed: in production, refuse to serve (503) when the limiter cannot be constructed, rather than silently skipping it. Add the guard's env vars to the documented deploy configuration so the default deployment is protected.
- Research
- OWASP LLM10:2025 Unbounded Consumption / Denial of Wallet (genai.owasp.org): A per-user quota that is absent in the default configuration provides no protection: unbounded consumption is governed by the deployed configuration, not by the presence of guard code.
- Fix prompt
- In app/generate/route.ts (around line 8), the rate limit is skipped when its settings are missing. Change it so the AI feature refuses requests (with a clear error) when the rate limit is not configured in production, instead of running without a limit, and list the required settings in the README. Keep everything else working the same, and tell me what you changed.
- Fix now
Paid AI jobs keep running after nobody is waiting
- What could happen
- If the page times out or the user closes the tab, the image or video job keeps running and billing. When they try again you pay twice.
- How to fix it
Give the wait a time limit and cancel the job with the provider when it is reached.
Paste it into your AI coding tool.
More details
- Where
app/generate/route.ts:69- Found by
- The built-in check "Paid job nobody waits for".
- In technical terms
- A billable async job is polled to completion with no deadline and no cancel path. If the poller dies the job keeps billing with nobody reading the result.
- Why it costs money
- Generation jobs are billed by the provider from the moment they are submitted, for the whole run. If this poll loop is killed (serverless timeout, client disconnect, restart) the job is never cancelled: you pay in full for a result nobody receives, and the user retries and pays again.
- Technical fix
- Bound the wait with a deadline, and on timeout or client abort call the provider's cancel endpoint before returning. Better: use the provider's wait/webhook mode so there is no poll loop to abandon.
- Research
- Replicate / OpenAI / Azure async job APIs (primary provider docs) (replicate.com): Async generation jobs bill for the full run once submitted, independent of whether the result is ever fetched; providers expose an explicit cancel endpoint precisely so an abandoned job can be stopped.
- Fix prompt
- In app/generate/route.ts (around line 69), the code waits for a paid AI job with no time limit and never cancels it. Add a deadline shorter than the platform's request timeout, cancel the job through the provider's cancel option when the deadline passes or the user disconnects, and return a clear timeout message. Keep everything else working the same, and tell me what you changed.
- Fix soon
Visitors can send anything they want to your AI
- What could happen
- The page passes what the visitor sends straight to the AI. Someone could send huge texts or their own prompts and use your account as a free AI service.
- What it could cost
No ceiling
Nothing limits how long a request can be, and each request is billed by your provider.
- How to fix it
Check the request first: allow only the fields you expect, with length limits.
Paste it into your AI coding tool.
More details
- Where
app/generate/route.ts:40- Found by
- The built-in check "Unchecked input sent to the AI".
- In technical terms
- Request-body fields reach a paid generation call with no schema or allowlist validation in the handler.
- Why it costs money
- Without a check on what the body may contain, the endpoint serves any workload a caller submits, not just your product's. Every abusive request is a full billed generation, and the volume is set by the attacker rather than by your users.
- Technical fix
- Validate the body before the paid call: check each field against its allowed set (or parse with a schema), and reject early, ideally before consuming any rate-limit quota.
- Research
- OWASP LLM10:2025 Unbounded Consumption / Denial of Wallet (genai.owasp.org): Unrestricted user input to a model endpoint enables resource-consumption abuse: attackers drive paid inference with inputs the application never intended to serve.
- Fix prompt
- In app/generate/route.ts (around line 40), the request is passed to the AI without checking it. Validate the request first with a schema: allow only the fields this feature needs, limit text lengths, allow only known values for options, and reject anything else with a clear error before any AI call is made. Keep everything else working the same, and tell me what you changed.
- Fix soon
You pay again for AI results you already have
- What could happen
- The same input gives the same result here, but the app asks the AI again every time, so repeats, refreshes and popular searches are paid for over and over.
- How to fix it
Save results by their input and reuse them instead of calling the AI again.
Paste it into your AI coding tool.
More details
- Where
app/generate/route.ts:40- Found by
- The built-in check "Same result paid for again".
- In technical terms
- A deterministic image call is served from a request handler with no result cache: identical inputs are recomputed and re-billed.
- Why it costs money
- The same input returns the same output, so every repeat (a retry, a refresh, two users asking for the same thing) is a second full charge for a result you already paid for.
- Technical fix
- Key a cache on a hash of the inputs that determine the output and read it before calling the provider; store the result with a TTL. A cache store already present in the repo is usually enough.
- Research
- GPTCache: An Open-Source Semantic Cache for LLM Applications (Bang, 2023) (aclanthology.org): Caching model responses keyed on input similarity removes redundant paid calls; repeated or near-identical requests are a large fraction of production traffic.
- Fix prompt
- In app/generate/route.ts (around line 40), the app pays for the same AI result again for identical input. Add a cache keyed on the model name plus a hash of the input, check it before calling the AI, and store new results with a sensible expiry. Keep everything else working the same, and tell me what you changed.
Your AI calls 1 place your app talks to an AI model
Where the scan found them. Your own AI did not trace these one by one.
app/generate/route.ts:40http
Technical details for you or a developer
Estimated exposure
None of the AI calls names its model in the code (it comes from a setting or a variable), so there is no repository-wide figure.
Spend map where the calls live, by estimated cost per 1k calls
| File | Sites | Models | Runs in | Findings | Est. per 1k calls |
|---|---|---|---|---|---|
| app/generate/route.ts | 1 | unresolved | request handler | 5 | not priced |
Models usage and right-sizing candidates
| Model | Sites | Est. per call | Est. per 1k calls, all sites |
|---|---|---|---|
| (not statically resolvable) | 1 | not priced | not priced |
No model was flagged as larger than its task needs.
Research behind this report
- Replicate / OpenAI / Azure async job APIs (primary provider docs) (replicate.com): Async generation jobs bill for the full run once submitted, independent of whether the result is ever fetched; providers expose an explicit cancel endpoint precisely so an abandoned job can be stopped.Built-in checks: Paid job nobody waits for
- When Agents Do Not Stop: Uncovering Infinite Agentic Loops in LLM Agents (arXiv:2607.01641): Cost exhaustion is a core agentic-loop harm; a spend guard is the backstop.Built-in checks: No spending cap
- OWASP LLM10:2025 Unbounded Consumption / Denial of Wallet (genai.owasp.org): A per-user quota that is absent in the default configuration provides no protection: unbounded consumption is governed by the deployed configuration, not by the presence of guard code.Built-in checks: Rate limit that depends on a setting, Unchecked input sent to the AI
- GPTCache: An Open-Source Semantic Cache for LLM Applications (Bang, 2023) (aclanthology.org): Caching model responses keyed on input similarity removes redundant paid calls; repeated or near-identical requests are a large fraction of production traffic.Built-in checks: Same result paid for again