
What happened
On April 16, Uehara's team made AIO Helper estimate each request's AI cost and stop it before the external AI API is called when the site's remaining monthly budget falls short, returning HTTP 402 on two features and skipping over-budget pages on batch suggestions.
Why it matters
Checking the balance before the AI call rather than after means the monthly cap can actually function as a control, while the app's ledger stays a fast-stop estimate separate from the provider's final invoice.
Summaries like this, every morning.
The starting point was a test audit: AIO Helper's admin screen already displayed the month's AI usage, but zero tests enforced a cap. Without a stop before the external call, a retry loop or bug could keep invoking a usage-billed model. The team therefore separated pricing from the data model, keeping a static price table in code because the OpenAI API response includes only token counts and no cost figure. A deliberately high fallback price for unknown models guards against a new model slipping past the cap at zero cost.
The enforcement design puts the budget check inside a single INSERT statement rather than a separate SELECT, so aggregation and write happen in one statement. Even so, this structure alone does not guarantee order when two requests arrive near the cap at once, and a real-Postgres competition test was not completed. A test-environment gap also surfaced: pg-mem lacked date_trunc, and 12 of 18 tests in the integration file failed with 500 errors at the time. Registering date_trunc reduced failures to five, and explicit type casts resolved the rest.
The soft warning added on April 23 keeps a cap of zero as a deliberate stop setting, separate from a near-limit warning, because showing both as the same yellow alert would lead users to assume waiting will restore service. The ledger does not cover embedding calls and the rebuild API, which were outside the cap in April, with records added to the rebuild API in September 2026, and calls that fail after the AI responds can incur cost without a ledger entry. The budget mechanism applies only to AI API spend inside AIO Helper, not to fixed cloud costs such as always-on Elastic Container Service or NAT Gateway charges.
Pick your industry and the AI tools you use, and get news related to your work every day.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.
ResearchAndMarkets.com added its "Asset Tracking Artificial Intelligence (AI) Market Global Report 2026," proj…

T-Mobile announced new AI-powered intelligence and resilience capabilities for its 5G network, aiming to make…

Copper futures sank to their lowest since April, with three-month copper (HG1:COM) on the London Metal Exchang…

At the Jefferies Global Healthcare Conference in London, Pfizer CEO Albert Bourla said Chinese biotech will be…

Amphenol reported record third-quarter sales of $10.2 billion, up 65% from a year earlier, and said roughly 36…

Nvidia shares jumped in premarket trading on a strong AI outlook, while Lowe's shares fell, Investing.com repo…
