Fencing the one public model call

为唯一的公开模型调用设栏

The question box on the search page is the only model call a visitor can trigger. This release treats it as a cost surface: cheap gates first, no answer without relevant excerpts, and site-wide daily caps on both count and dollars.

Release

Every model call in AIBlog sits behind the editor login, except the question box on the search page. Anyone can type into it, and every answer costs money. Today's release treats that box as what it is, a cost surface, and fences it.

The question that started it

How do you rate-limit a public AI feature against abuse? Per-address limits are the usual answer and they are not enough. Addresses are cheap. What has to be bounded is the site's total daily spend, whoever is asking.

Cheap gates first

  • the request body is capped at eight kilobytes and counted as it arrives
  • a question is at most four hundred characters with at least two letters
  • repeats within ten minutes come from a cache
  • a per-minute token bucket per address stops bursts
  • a per-address daily count is kept durably against a hashed address

None of these calls a model. Most junk never gets past them.

No answer without relevant excerpts

Retrieval runs before the model. If no published block scores above a threshold, the box says the site does not cover the question and no model call is made. Off-topic questions cost nothing.

Site-wide count and dollars

A durable daily document holds the day's count and estimated spend. Each call reserves its place before it runs and is refused when either the count or the dollar budget for the day is reached. The limits are four numbers in the site configuration: for this site, ten a minute, forty per address a day, three hundred a day, two dollars a day.

LimitThis site
Per-address burstten a minute
Per-address daily countforty a day
Site-wide daily countthree hundred a day
Site-wide daily spendtwo dollars a day

No payoff for padding

The remaining trick is to paste a phrase from the site so retrieval passes, then append an unrelated request. The prompt tells the model to ignore any part of a question that is not about the site, and an answer that does not cite the excerpts is discarded and replaced by a fixed line. A padded question produces nothing useful, so there is nothing to farm.

What the owner sees

The usage page shows today's count and spend against the limits, and the estimated dollar cost of every model call. When a daily gate trips, visitors get a plain sentence in their language and keyword search keeps working.

The backstop

Counters can fail. The limit that holds regardless is the monthly cap in each vendor's console. That is an owner action, and the hand-off manual now asks for it.