For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DashboardSign Up
  • Getting Started
    • Welcome
    • Quick Start
    • Authentication
  • Native Mode
    • Overview
    • OpenAI
    • Anthropic
    • Gemini
  • Unified Mode
    • Overview
    • Python
    • TypeScript
    • cURL
  • Platform
    • Key Management
    • Rate Limits & Budgets
    • Usage & Billing
    • Error Reference
  • API Reference
DashboardSign Up
On this page
  • Per-key rate limits
  • Organization rate limits
  • Rate limit headers
  • Budget controls
  • Hard budget
  • Soft budget
  • Budget periods
  • Per-key spend limits
  • Credit balance
Platform

Rate Limits & Budgets

Control request rates and spending
Was this page helpful?
Edit this page
Previous

Usage & Billing

Credits, cost tracking, and savings
Next
Built with

Gateway AI enforces rate limits and budget controls at both the key and organization level.

Per-key rate limits

Each proxy key can have a requests per minute (RPM) limit. When the limit is exceeded, the gateway returns 429 Too Many Requests with "error": "rate_limited".

Set this when creating or editing a key in the dashboard, or via the management API.

Organization rate limits

Organization-wide RPM limits are configured through budget configs. These apply across all keys in the org. When exceeded, the gateway returns 429 with "error": "organization_rate_limited".

Rate limit headers

When a key has a rate limit configured, the gateway includes these headers in every response:

HeaderDescription
X-RateLimit-LimitThe RPM limit for this key
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the window resets

For org-level limits, additional headers are included:

HeaderDescription
X-RateLimit-Org-LimitThe org-wide RPM limit
X-RateLimit-Org-RemainingOrg requests remaining
X-RateLimit-ScopeSet to organization on org-level 429 responses

Budget controls

Budget configs let you set spending limits for your organization:

Hard budget

When the organization’s spend reaches the max budget for the current period, all requests are denied with 403 budget_exceeded.

Soft budget

When spend reaches the soft budget threshold, requests are still allowed but the gateway adds a warning header:

X-Budget-Warning: approaching_limit

Use this to trigger alerts in your application before hitting the hard limit.

Budget periods

Budgets reset automatically based on the configured duration:

PeriodResets at
dailyMidnight UTC
weeklyStart of week (Sunday midnight UTC)
monthlyFirst of the month, midnight UTC
neverCumulative, never resets

Per-key spend limits

Individual keys can also have spend limits:

  • Spend limit ($) — maximum dollar amount this key can spend
  • Reset period — daily, weekly, monthly, or never

When a key exceeds its spend limit, requests are denied with 403 spend_exceeded.

Credit balance

Your organization maintains a credit balance. Every request deducts from this balance based on token usage and model pricing. When credits run out, requests are denied with 403 insufficient_credits.

Purchase credits in Settings > Billing in your dashboard.