NexRelayNexRelay
Guides

API budget control

How to control AI API costs with budgets and prepaid balance

AI API usage can grow quickly when agents, retries, long context, or multiple teammates share keys. Budget controls let teams cap spend before a request is sent upstream.

Budget controls that matter

A gateway should check wallet balance, daily and monthly key budgets, model allowlists, IP rules, and max output limits before sending a request.

Common use cases

Budget controls are useful for internal tools, SaaS trials, customer-facing agents, and background jobs.

  • Limit keys by spend
  • Keep high-cost models behind allowlists
  • Use smaller caps for trial keys

Prepaid vs overage

Prepaid gateways stop at zero balance. Overage systems may keep serving requests and create an invoice later.

FAQ

Should failed requests be billed?

Balance and budget rejections should not be billed.

Can budgets replace logs?

No. Budgets stop spend, while logs explain where spend went.