The AI assistant on the site generates costs — how to set limits?
The portfolio chat works, but every question costs, and the public endpoint can be called repeatedly.
Why is there a problem?
Without the limits on the number of requests, the budget and the length of the context, a single user or bot may use a large part of the funds.
Diagnostics and solutions
1. Set a monthly spending limit and the maximum cost of one call.
2 . Enter the limiting rate on the server, including addresses and sessions, without excessive user identification.
3 . Reduce history length and maximum response tokens.
4 . Apply timeouts, 429 support and controlled fallbacks for an unavailable model.
5 . Monitor daily consumption, threshold alarms and response quality.
How to check and avoid what?
Tests of a large number of requests trigger limits, and a single failure of the supplier does not suspend the page.
Just hiding the chat button does not protect the public endpoint API.