How one developer kept bots and trolls from draining an AI chatbot budget
Running a public AI chatbot can become expensive quickly, since every message costs money and open chat boxes attract bots, bored visitors, and people hunting for free AI access. The author describes a common failure where a site's balance is wiped out overnight by automated traffic. The first and most critical safeguard is keeping the provider API key on the server rather than in frontend code, where anyone could copy it. Additional defenses include domain-locked public tokens checked against request Origin or Referer headers, and a per-chatbot daily message cap enforced with an atomic counter like Redis INCR. Per-IP rate limits and honeypot fields are also recommended, along with warning the owner before limits are reached.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in