---
title: AI Gateway Rate Limits
product: vercel
url: /docs/ai-gateway/rate-limits
canonical_url: "https://vercel.com/docs/ai-gateway/rate-limits"
last_updated: 2018-10-20
type: reference
prerequisites:
  - /docs/ai-gateway
related:
  - /docs/ai-gateway/pricing
  - /docs/ai-gateway/observability-and-spend/budgets
  - /docs/ai-gateway/authentication-and-byok/byok
  - /docs/ai-gateway/getting-started
summary: Learn how AI Gateway rate limits work on the free and paid tiers, what the 429 response looks like, and how to retry a rate-limited request.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# AI Gateway Rate Limits

AI Gateway does not rate limit paid-tier requests. The free tier applies lower per-model limits, and a `429` on either tier may come from the upstream provider rather than from AI Gateway.

## How rate limits work

On the free tier, AI Gateway enforces a lower limit per model, and exceeding it rejects further requests to that model until your request rate drops. The paid tier removes AI Gateway's limits entirely, so the only limits left are the upstream provider's, whether the request uses AI Gateway credentials or your own provider keys.

Whether a `429` comes from AI Gateway or the provider, the retry behavior below is the same. A provider's `429` can carry that provider's own error body instead of the AI Gateway error shape.

Limits can change, so this page describes behavior rather than fixed numbers. To confirm the current limit for a model, contact Vercel from your dashboard's **Support** entry.

## Free tier and paid tier

|                | Free tier                                                    | Paid tier                            |
| -------------- | ----------------------------------------------------------- | ------------------------------------ |
| Model access   | [Free-tier-eligible models](/ai-gateway/models?freeTier=true) | All available models                 |
| Rate limits    | Lower limit per model                                       | None from AI Gateway; provider limits still apply |
| Custom limits  | Not available                                               | Available on request                 |
| Credit basis   | Monthly included credit                                     | Purchased AI Gateway Credits         |

Purchasing AI Gateway Credits moves your team to the paid tier, which raises your rate limits. See [AI Gateway Pricing](/docs/ai-gateway/pricing) for tiers, credits, and model rates.

## When a request exceeds a limit

A rate-limited request gets an HTTP `429` response. From AI Gateway, the body is a JSON error:

```json filename="Error response"
{
  "error": {
    "message": "Rate limit exceeded",
    "type": "rate_limit_exceeded"
  }
}
```

Some `429` responses include a `retry-after` header with the number of seconds to wait. Honor it when it is present.

A `429` response is not a failure of your request. The same request can succeed later without changes, so retry it rather than editing it.

## Retry a rate-limited request

The AI SDK retries failed requests automatically with exponential backoff, and its `maxRetries` option defaults to `2`. For a direct HTTP client, honor `retry-after` when it is present and parseable, and back off exponentially otherwise:

```typescript filename="retry.ts"
// `retry-after` is either a number of seconds or an HTTP date. Anything that
// doesn't parse falls through to exponential backoff, so a malformed header
// can't collapse the wait to zero and turn the loop into a burst of requests.
function retryAfterMs(header: string | null): number | null {
  if (!header) return null;

  const seconds = Number(header);
  if (Number.isFinite(seconds) && seconds >= 0) return seconds * 1000;

  const date = Date.parse(header);
  if (Number.isNaN(date)) return null;

  return Math.max(0, date - Date.now());
}

async function chatWithRetry(body: string, maxAttempts = 4): Promise<Response> {
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
    const response = await fetch(
      'https://ai-gateway.vercel.sh/v1/chat/completions',
      {
        method: 'POST',
        headers: {
          Authorization: `Bearer ${process.env.AI_GATEWAY_API_KEY}`,
          'Content-Type': 'application/json',
        },
        body,
      },
    );

    if (response.status !== 429) {
      return response;
    }

    // Don't sleep after the final attempt.
    if (attempt === maxAttempts - 1) break;

    const delayMs =
      retryAfterMs(response.headers.get('retry-after')) ?? 2 ** attempt * 1000;
    await new Promise((resolve) => setTimeout(resolve, delayMs));
  }

  throw new Error('Request still rate limited after all retries');
}
```

Keep retries bounded. If a workload hits a limit regularly, raise the limit instead of lengthening the backoff.

## Rate limits versus budgets

Rate limits and budgets both reject requests, but for different reasons:

|                      | Rate limit                   | Budget                                            |
| -------------------- | ---------------------------- | ------------------------------------------------- |
| What it caps         | Request rate for a model     | Spend in dollars                                  |
| Who sets it          | Vercel, per tier             | You, per team, project, API key, or user          |
| Response when hit    | `429`                        | `402` with `quota_for_entity_exceeded`            |
| Recovery             | Retry after a short wait     | Wait for the refresh period or raise the limit    |

To cap spend instead of request rate, set a [budget](/docs/ai-gateway/observability-and-spend/budgets).

## Rate limits with BYOK

[BYOK](/docs/ai-gateway/authentication-and-byok/byok) requests use your own provider credentials, so the provider's own rate limits apply to them. When a BYOK request fails and falls back to AI Gateway system credentials, the fallback attempt is subject to AI Gateway rate limits, and its usage is billed to your AI Gateway Credits.

## Raise a limit

Purchase [AI Gateway Credits](/docs/ai-gateway/pricing#top-up-your-ai-gateway-credits) to move your team to the paid tier, which removes AI Gateway's rate limits. If a provider-side limit still constrains a workload, paid-tier teams can request custom arrangements. [Contact sales](/contact/sales) to discuss custom limits.

## Next steps

- [AI Gateway Pricing](/docs/ai-gateway/pricing) for tiers, credits, and model rates
- [Budgets](/docs/ai-gateway/observability-and-spend/budgets) to cap spend by team, project, API key, or team member
- [Troubleshoot your first request](/docs/ai-gateway/getting-started#troubleshoot-your-first-request) for the other first-run errors


---

[View full sitemap](/docs/sitemap)
