Bridge by Wekoya / Guides / How to stop one user from running up your AI bill

How to stop one user from running up your AI bill

In short: Give every user of your app their own budget and every key its own limit. On Bridge by Wekoya you send the X-Bridge-End-User header with each request, and Bridge meters that user and stops them at their budget with a 402, while everyone else carries on.

Updated

Three limits, from widest to narrowest

Name the user on each request

reply = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": question}],
    extra_headers={"X-Bridge-End-User": user.id},
)

Create each user first, or turn on auto-create in the console. When a user's budget is spent, their requests get a 402 end_user_budget_exhausted; show them a friendly message instead of an error.

Create a free account

Common questions

What happens when a user runs out of budget?

Their requests are refused with 402 end_user_budget_exhausted, and nothing is charged for the refused request. Other users are not affected.

Can I call Bridge straight from a mobile app?

Not with your API key, which must stay on your server. Your server makes a short-lived guest key for the signed-in user, limited in spend and uses, and the app uses that.

Read next