Skip to Content

AI Gateway

Authentication & BYOK


AI Gateway API Keys

Use API keys to authenticate AI Gateway requests. You can:

API Keys

OIDC tokens on Vercel deployments.

Copy page

  • Create a key in the dashboard, with the Vercel CLI, or via the Vercel API
  • View your keys and their usage
  • Attribute a key's spend to your team or an individual member
  • Delete or revoke a key

Create a key

Create a key from the dashboard, the Vercel CLI, or the Vercel API.


Dashboard

Every AI Gateway API key is attributed to either your team or a single team member. Attribution controls whose budget the key's spend counts against:

CLI

  1. Open the API Keys page. Go to the AI Gateway API Keys page and click Create key.
  2. Name and create the key. Give the key a name and create it.
  3. Save the key. Copy the key value immediately (you cannot retrieve it again) and save it as AI_GATEWAY_API_KEY.

API

To cap how much a key can spend, add a budget when you create it. See Budgets. By default, a new key's spend is attributed to you. To attribute it to your team instead, see Spend attribution.

  • User: the key's spend counts toward both the team budget and the key creator's user budget.
  • Team: the key's spend counts toward the team budget only.

Budgets stack rather than split. A key attributed to a member counts against both that member's budget and the team budget on every request, and the request is rejected if either is exceeded. The team budget caps total spend, and a user budget caps one member's share of it.

New keys default to User attribution. A key with no attribution set counts toward the Team, which covers keys created before spend attribution shipped and any key created through the API without metadata.spendAttribution. Only team Owners and AI Gateway Budget Managers can set or change a key's attribution.

  1. Open the create- or edit-key dialog. On the AI Gateway API Keys page, click Create key, or open a key's ··· menu and select Edit key.
  2. Set spend attribution. Under Spend attribution, choose User or Team.
  3. Save.

View a key

List your keys from the dashboard, the Vercel CLI, or the Vercel API.

The AI Gateway API Keys page lists every key with its last-used time. A budgeted key also shows its spend against the limit; see Budgets.

Edit a key

Delete a key

Deleting a key immediately invalidates it. Any request using it afterward fails authentication.


Dashboard

If a raw key has leaked, revoke it without authentication by reporting it:

API

A key's editable properties are its budget and its spend attribution. To add, change, or remove a budget, see Budgets. To change attribution, see Spend attribution. To change anything else, such as the name, delete the key and create a new one.

CLI

On the API Keys page, open a key's ··· menu to delete it, or use the ··· menu next to Create key to delete all keys at once.

-H"Content-Type: application/json" \

-d'{ "secret": { "api_key": "vck_..." } }'


Last updated September 8, 2026

curl -XPOST"https://api.vercel.com/external/compromised_secret" \


Was this helpful?


Cross-link map: AI Gateway API Keys (/docs/ai-gateway/authentication-and-byok/api-keys)From the Vercel docs graph (built 2026-09-21T05:26:59.511Z), spanning vercel.com docs + KB, nextjs.org, ai-sdk.dev, and other Vercel documentation sites. Full graph as JSON: https://vercel.com/docs/graph.jsonSemantically closest pagesBudgets for API keys on AI GatewayAI Gateway Budgets and Spend Limits — Cap AI Gateway spend for your team, a project, an individual API key, or a team member with budgets, refresh periods, spAI Gateway Authentication and BYOK — Authenticate AI Gateway requests with API keys or OIDC tokens, and configure bring your own key \(BYOK\) credentials forAI Gateway Observability and Spend — Monitor AI Gateway requests and control costs with logs, generation lookup, custom reporting, budgets, and OpenTelemetryHow to route your coding agent spend through AI Gateway — Point Claude Code, Codex, Cursor, and every other harness on your machine at AI Gateway with one CLI command, on a budgeThis page links to (5)AI Gateway Authentication and BYOK — Authenticate AI Gateway requests with API keys or OIDC tokens, and configure bring your own key \(BYOK\) credentials forAI Gateway OIDC Authentication — Authenticate AI Gateway requests from Vercel deployments with OIDC tokens. Configure the AI SDK or send bearer tokens diAI Gateway Budgets and Spend Limits — Cap AI Gateway spend for your team, a project, an individual API key, or a team member with budgets, refresh periods, spVercel CLI Overview — Learn how to use the Vercel command-line interface \(CLI\) to manage and configure your Vercel Projects from the commandVercel REST API Reference — Interact programmatically with your Vercel account using the SDK or direct HTTP requests.Pages that link here (46)By site: chat-sdk (1) · vercel-changelog (29) · vercel-kb (2) · vercel-docs (14)From chat-sdkTanStack AI — Feed thread history into TanStack AI's chat() and give it Chat SDK tools, with no runtime dependency on @tanstack/ai.From vercel-changelogBudgets for API keys on AI GatewayClaude Sonnet 5 now available on Vercel AI GatewayDeepSeek models now available via Azure on AI GatewayDeepSeek V4.1 Flash now available on AI GatewayGemini 3.6 Flash and Gemini 3.5 Flash-Lite are now available on AI GatewayGemini 3.7 Flash now available on AI Gateway for 50% offGLM 5.2 Fast via Wafer now available on AI GatewayGLM 5.2 now available on AI GatewayGLM 5.3 FlashX now available on AI GatewayGLM 5.3 now available on AI GatewayGPT 5.6 Sol, Luna, and Terra now available on AI GatewayGrok 4.5 now available on AI GatewayGrok 4.6 now available on AI GatewayHy4 Preview now available on AI GatewayInkling from Thinking Machines is now available on AI GatewayKimi K2.7 Code now available on AI GatewayKimi K3 is now available on AI GatewayLaguna S 2.1 is now available on AI GatewayLing 3.0 Flash is now available on AI GatewayLing 3.0 Tiny is now available on AI GatewayMuse Image now available on AI GatewayMuse Spark 1.1 is now available on AI GatewayMuse Spark 1.2 is now available on Vercel AI GatewayNano Banana 2 Lite (Gemini 3.1 Flash Lite Image) now on AI GatewayQwen 3.8 Flash now available on AI GatewayQwen 3.8 Max now available on Vercel AI GatewaySakana Fugu Ultra now available on AI GatewaySeedream 5.0 Pro is now available on AI GatewaySet up coding agents in one command with AI GatewayFrom vercel-kbHow to architect an AI evaluation dashboard on Vercel — Map eval orchestration, traces, and run storage to AI Gateway, Observability, and Marketplace Postgres, and learn when sCost-aware model routing through AI Gateway — Route easy requests to a cheap model and escalate only hard ones to a frontier model through one AI Gateway endpoint, wiFrom vercel-docsVercel AI Gateway: Models, Routing, and Observability — Call AI models from any infrastructure through a managed gateway. Centralize credentials, request logs, spend budgets, rAI Gateway Authentication and BYOK — Authenticate AI Gateway requests with API keys or OIDC tokens, and configure bring your own key \(BYOK\) credentials forAmp with AI Gateway — Connect Amp to AI Gateway through Amp's Model Routing settings. Add an AI Gateway API key, choose models for Amp's modesHarbor with AI Gateway — Evaluate coding-agent harnesses with Harbor and AI Gateway. Choose a harness, configure its connection, and pass separatTanStack AI with AI Gateway — Connect TanStack AI to Vercel AI Gateway with the official adapter to authenticate requests and stream responses from AIWordPress with AI Gateway — Learn how to integrate Vercel AI Gateway with WordPress to let your plugins access multiple AI models.AI Gateway FAQ — Answers to common questions about AI Gateway, including request errors, pricing and markup, SDK and API compatibility, mAI Gateway Budgets and Spend Limits — Cap AI Gateway spend for your team, a project, an individual API key, or a team member with budgets, refresh periods, spAI Gateway Custom Reporting API — Query AI Gateway usage data grouped by model, user, tag, provider, or credential type using the Custom Reporting API.AI Gateway SDKs and APIs — Connect to AI Gateway with the AI SDK, Python, REST, or compatible OpenAI, Anthropic Messages, OpenResponses, and CoherePython with AI Gateway: OpenAI and Anthropic SDKs — Use AI Gateway with Python through OpenAI or Anthropic SDKs with full streaming, tool calling, and async support.vercel ai-gateway — Manage AI Gateway resources from the Vercel CLI: API keys, budgets, routing rules, virtual models, models, leaderboards,AI SDK with MCP — Connect the AI SDK to an MCP server on Vercel, discover its tools, and call them with models served through AI Gateway.TanStack AI with MCP — Connect TanStack AI to a Model Context Protocol server on Vercel and call its tools with models served through AI Gatewa