ai-gateway

Update an AI Gateway API key budget

Changed on

Set, change, or remove the AI Gateway budget on an API key. Creates the budget if the key does not have one.

patch/api-keys/{apiKeyID}/quota

Request

  • Base URL: https://api.vercel.com
  • URL: https://api.vercel.com/api-keys/{apiKeyID}/quota
  • Auth: HTTP bearer

Path parameters

apiKeyIDstring required

The ID of the API key whose quota should be updated.

Request body

limitAmountnumber

The quota limit amount. Required if the quota does not yet exist.

includeByokInQuotaboolean

Whether BYOK (Bring Your Own Key) usage counts against the quota.

refreshPeriod'daily' | 'weekly' | 'monthly' | 'none'

How often the quota refreshes.

activeboolean

Whether the quota is currently active.

archivedboolean

Set to true to archive (soft-delete) the quota. The api key itself is unaffected.

alertThresholdsnumber[]

Spend percentages (a subset of [50, 75, 100]) at which to send a spend alert. Pass an empty array to disable alerts.

Response

Successfully updated the API key quota.

Example response

{
  "apiKey": {
    "id": "5d9f2ebd38ddca62e5d51e9c1704c72530bdc8bfdd41e782a6687c48399e8391",
    "name": "API Key for AI Gateway",
    "partialKey": "t7V",
    "teamId": "team_123a6c5209bc3778245d011443644c8d27dc2c50",
    "purpose": "ai-gateway",
    "projectId": "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
    "expiresAt": 1632816536002,
    "activeAt": 1632816536002,
    "createdAt": 1632816536002,
    "createdBy": "ZspSRT4ljIEEmMHgoDwKWDei",
    "leakedAt": 1632816536002
  }
}

Changes