# Stop free users from running up your AI bill

A free plan with an LLM behind it is an open tab. Most users cost cents; a few cost dollars a day, and a script can cost hundreds. Rate limits per minute don't help, because the damage is in tokens, not requests.

## Limit spend per user

Set a dollar budget per user per period, and stop the call before it's made:

```python [Python]
import veqen

veqen.budget(2.00, user="*", period="month")      # each free user: $2 of inference a month

def answer(user, question):
    with veqen.tags(user=user.id, customer=user.org_id):
        try:
            return client.responses.create(model="gpt-5-mini", input=question)
        except veqen.BudgetExceeded:
            return "You've reached this month's free AI usage. Upgrade to keep going."
```

```ts [TypeScript]
budget(2, { user: "*", period: "month" });

try {
  return await withTags({ user: user.id }, () => client.responses.create({ model: "gpt-5-mini", input: question }));
} catch (error) {
  if (error instanceof BudgetExceeded) return upgradeMessage();
  throw error;
}
```

An SDK budget counts recorded spend inside one process and resets on restart. For several servers, also create a dashboard budget (scope: user, value `*`, mode: block). Each SDK blocks subsequent wrapped calls after it polls a breached budget. In-flight calls, concurrency and ingestion or polling delays can exceed the limit; there is no guaranteed maximum delay or spending cap. On the Free plan, cloud budgets stop seeing new spend once the plan's 60,000 tracked calls are used for the month; SDK budgets keep counting. See [budget enforcement limits](/docs/budgets).

## Pick the limit from data

Look at cost per user for a month before setting limits: a high percentile (the 95th, say) is usually a fair free allowance, and anything ten times the median deserves a look. The Explore page grouped by `user` lists cost per user; export it to work out the percentiles.

## Also worth doing

- Use cheaper models for free users: the [simulator](/simulate) shows the price difference on your workload.
- Cache shared context. Cached input is billed at about a tenth of the input rate on most models.
- Alert on spikes: Veqen emails you when your organization's spend for a day is at least $25 and twice its average day the week before. It watches the organization's total, so per-user limits are still the guard against one heavy user.
