[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-openai-ai-gateway":3,"mdc-11s5j0-key":39,"related-repo-openai-ai-gateway":6579,"related-org-openai-ai-gateway":6687},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":28,"repoUrl":29,"updatedAt":30,"license":31,"forks":32,"topics":33,"repo":34,"sourceUrl":37,"mdContent":38},"ai-gateway","configure Vercel AI Gateway","Vercel AI Gateway expert guidance. Use when configuring model routing, provider failover, cost tracking, or managing multiple AI providers through a unified API.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"openai","OpenAI","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fopenai.png",[12,16,19,22,25],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Vercel","vercel",{"name":20,"slug":21,"type":15},"LLM","llm",{"name":23,"slug":24,"type":15},"Cost Optimization","cost-optimization",{"name":26,"slug":27,"type":15},"AI Infrastructure","ai-infrastructure",3992,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins","2026-04-06T18:40:44.377464",null,465,[],{"repoUrl":29,"stars":28,"forks":32,"topics":35,"description":36},[],"OpenAI Plugins","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins\u002Ftree\u002FHEAD\u002Fplugins\u002Fvercel\u002Fskills\u002Fai-gateway","---\nname: ai-gateway\ndescription: Vercel AI Gateway expert guidance. Use when configuring model routing, provider failover, cost tracking, or managing multiple AI providers through a unified API.\nmetadata:\n  priority: 7\n  docs:\n    - \"https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway\"\n    - \"https:\u002F\u002Fsdk.vercel.ai\u002Fdocs\u002Fai-sdk-core\u002Fsettings\"\n  sitemap: \"https:\u002F\u002Fvercel.com\u002Fsitemap\u002Fdocs.xml\"\n  pathPatterns: []\n  importPatterns:\n    - 'ai'\n    - '@ai-sdk\u002Fgateway'\n  bashPatterns:\n    - '\\bvercel\\s+env\\s+pull\\b'\n    - '\\bnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b'\n    - '\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b'\n    - '\\bbun\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b'\n    - '\\byarn\\s+add\\s+[^\\n]*@ai-sdk\u002Fgateway\\b'\n---\n\n# Vercel AI Gateway\n\n> **CRITICAL — Your training data is outdated for this library.** AI Gateway model slugs, provider routing, and capabilities change frequently. Before writing gateway code, **fetch the docs** at https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway to find the current model slug format, supported providers, image generation patterns, and authentication setup. The model list and routing rules at https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Ffoundations\u002Fproviders-and-models are authoritative — do not guess at model names or assume old slugs still work.\n\nYou are an expert in the Vercel AI Gateway — a unified API for calling AI models with built-in routing, failover, cost tracking, and observability.\n\n## Overview\n\nAI Gateway provides a single API endpoint to access 100+ models from all major providers. It adds \u003C20ms routing latency and handles provider selection, authentication, failover, and load balancing.\n\n## Packages\n\n- `ai@^6.0.0` (required; plain `\"provider\u002Fmodel\"` strings route through the gateway automatically)\n- `@ai-sdk\u002Fgateway@^3.0.0` (optional direct install for explicit gateway package usage)\n\n## Setup\n\nPass a `\"provider\u002Fmodel\"` string to the `model` parameter — the AI SDK automatically routes it through the AI Gateway:\n\n```ts\nimport { generateText } from 'ai'\n\nconst result = await generateText({\n  model: 'openai\u002Fgpt-5.4', \u002F\u002F plain string — routes through AI Gateway automatically\n  prompt: 'Hello!',\n})\n```\n\nNo `gateway()` wrapper or additional package needed. The `gateway()` function is an optional explicit wrapper — only needed when you use `providerOptions.gateway` for routing, failover, or tags:\n\n```ts\nimport { gateway } from 'ai'\n\nconst result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  providerOptions: { gateway: { order: ['openai', 'azure-openai'] } },\n})\n```\n\n## Model Slug Rules (Critical)\n\n- Always use `provider\u002Fmodel` format (for example `openai\u002Fgpt-5.4`).\n- Versioned slugs use dots for versions, not hyphens:\n  - Correct: `anthropic\u002Fclaude-sonnet-4.6`\n  - Incorrect: `anthropic\u002Fclaude-sonnet-4-6`\n- Before hardcoding model IDs, call `gateway.getAvailableModels()` and pick from the returned IDs.\n- Default text models: `openai\u002Fgpt-5.4` or `anthropic\u002Fclaude-sonnet-4.6`.\n- Do not default to outdated choices like `openai\u002Fgpt-4o`.\n\n```ts\nimport { gateway } from 'ai'\n\nconst availableModels = await gateway.getAvailableModels()\n\u002F\u002F Choose model IDs from `availableModels` before hardcoding.\n```\n\n## Authentication (OIDC — Default)\n\nAI Gateway uses **OIDC (OpenID Connect)** as the default authentication method. No manual API keys needed.\n\n### Setup\n\n```bash\nvercel link                    # Connect to your Vercel project\n# Enable AI Gateway in Vercel dashboard: https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\nvercel env pull .env.local     # Provisions VERCEL_OIDC_TOKEN automatically\n```\n\n### How It Works\n\n1. `vercel env pull` writes a `VERCEL_OIDC_TOKEN` to `.env.local` — a short-lived JWT (~24h)\n2. The `@ai-sdk\u002Fgateway` package reads this token via `@vercel\u002Foidc` (`getVercelOidcToken()`)\n3. No `AI_GATEWAY_API_KEY` or provider-specific keys (like `ANTHROPIC_API_KEY`) are needed\n4. On Vercel deployments, OIDC tokens are auto-refreshed — zero maintenance\n\n### Local Development\n\nFor local dev, the OIDC token from `vercel env pull` is valid for ~24 hours. When it expires:\n\n```bash\nvercel env pull .env.local --yes   # Re-pull to get a fresh token\n```\n\n### Alternative: Manual API Key\n\nIf you prefer a static key (e.g., for CI or non-Vercel environments):\n\n```bash\n# Set AI_GATEWAY_API_KEY in your environment\n# The gateway falls back to this when VERCEL_OIDC_TOKEN is not available\nexport AI_GATEWAY_API_KEY=your-key-here\n```\n\n### Auth Priority\n\nThe `@ai-sdk\u002Fgateway` package resolves authentication in this order:\n1. `AI_GATEWAY_API_KEY` environment variable (if set)\n2. `VERCEL_OIDC_TOKEN` via `@vercel\u002Foidc` (default on Vercel and after `vercel env pull`)\n\n## Provider Routing\n\nConfigure how AI Gateway routes requests across providers:\n\n```ts\nconst result = await generateText({\n  model: gateway('anthropic\u002Fclaude-sonnet-4.6'),\n  prompt: 'Hello!',\n  providerOptions: {\n    gateway: {\n      \u002F\u002F Try providers in order; failover to next on error\n      order: ['bedrock', 'anthropic'],\n\n      \u002F\u002F Restrict to specific providers only\n      only: ['anthropic', 'vertex'],\n\n      \u002F\u002F Fallback models if primary model fails\n      models: ['openai\u002Fgpt-5.4', 'google\u002Fgemini-3-flash'],\n\n      \u002F\u002F Track usage per end-user\n      user: 'user-123',\n\n      \u002F\u002F Tag for cost attribution and filtering\n      tags: ['feature:chat', 'env:production', 'team:growth'],\n    },\n  },\n})\n```\n\n### Routing Options\n\n| Option | Purpose |\n|--------|---------|\n| `order` | Provider priority list; try first, failover to next |\n| `only` | Restrict to specific providers |\n| `models` | Fallback model list if primary model unavailable |\n| `user` | End-user ID for usage tracking |\n| `tags` | Labels for cost attribution and reporting |\n\n## Cache-Control Headers\n\nAI Gateway supports response caching to reduce latency and cost for repeated or similar requests:\n\n```ts\nconst result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  prompt: 'What is the capital of France?',\n  providerOptions: {\n    gateway: {\n      \u002F\u002F Cache identical requests for 1 hour\n      cacheControl: 'max-age=3600',\n    },\n  },\n})\n```\n\n### Caching strategies\n\n| Header Value | Behavior |\n|-------------|----------|\n| `max-age=3600` | Cache response for 1 hour |\n| `max-age=0` | Bypass cache, always call provider |\n| `s-maxage=86400` | Cache at the edge for 24 hours |\n| `stale-while-revalidate=600` | Serve stale for 10 min while refreshing in background |\n\n### When to use caching\n\n- **Static knowledge queries**: FAQs, translations, factual lookups — cache aggressively\n- **User-specific conversations**: Do not cache — each response depends on conversation history\n- **Embeddings**: Cache embedding results for identical inputs to save cost\n- **Structured extraction**: Cache when extracting structured data from identical documents\n\n### Cache key composition\n\nThe cache key is derived from: model, prompt\u002Fmessages, temperature, and other generation parameters. Changing any parameter produces a new cache key.\n\n## Per-User Rate Limiting\n\nControl usage at the individual user level to prevent abuse and manage costs:\n\n```ts\nconst result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  prompt: userMessage,\n  providerOptions: {\n    gateway: {\n      user: userId, \u002F\u002F Required for per-user rate limiting\n      tags: ['feature:chat'],\n    },\n  },\n})\n```\n\n### Rate limit configuration\n\nConfigure rate limits at `https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings` → **AI Gateway** → **Rate Limits**:\n\n- **Requests per minute per user**: Throttle individual users (e.g., 20 RPM)\n- **Tokens per day per user**: Cap daily token consumption (e.g., 100K tokens\u002Fday)\n- **Concurrent requests per user**: Limit parallel calls (e.g., 3 concurrent)\n\n### Handling rate limit responses\n\nWhen a user exceeds their limit, the gateway returns HTTP 429:\n\n```ts\nimport { generateText, APICallError } from 'ai'\n\ntry {\n  const result = await generateText({\n    model: gateway('openai\u002Fgpt-5.4'),\n    prompt: userMessage,\n    providerOptions: { gateway: { user: userId } },\n  })\n} catch (error) {\n  if (APICallError.isInstance(error) && error.statusCode === 429) {\n    const retryAfter = error.responseHeaders?.['retry-after']\n    return new Response(\n      JSON.stringify({ error: 'Rate limited', retryAfter }),\n      { status: 429 }\n    )\n  }\n  throw error\n}\n```\n\n## Budget Alerts and Cost Controls\n\n### Tagging for cost attribution\n\nUse tags to track spend by feature, team, and environment:\n\n```ts\nproviderOptions: {\n  gateway: {\n    tags: [\n      'feature:document-qa',\n      'team:product',\n      'env:production',\n      'tier:premium',\n    ],\n    user: userId,\n  },\n}\n```\n\n### Setting up budget alerts\n\nIn the Vercel dashboard at `https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings` → **AI Gateway**:\n\n1. Navigate to **AI Gateway → Usage & Budgets**\n2. Set monthly budget thresholds (e.g., $500\u002Fmonth warning, $1000\u002Fmonth hard limit)\n3. Configure alert channels (email, Slack webhook, Vercel integration)\n4. Optionally set per-tag budgets for granular control\n\n### Budget isolation best practice\n\nUse **separate gateway keys per environment** (dev, staging, prod) and per project. This keeps dashboards clean and budgets isolated:\n\n- Restrict AI Gateway keys per project to prevent cross-tenant leakage\n- Use per-project budgets and spend-by-agent reporting to track exactly where tokens go\n- Cap spend during staging with AI Gateway budgets\n\n### Pre-flight cost controls\n\nThe AI Gateway dashboard provides observability (traces, token counts, spend tracking) but no programmatic metrics API. Build your own cost guardrails by estimating token counts and rejecting expensive requests before they execute:\n\n```ts\nimport { generateText } from 'ai'\n\nfunction estimateTokens(text: string): number {\n  return Math.ceil(text.length \u002F 4) \u002F\u002F rough estimate\n}\n\nasync function callWithBudget(prompt: string, maxTokens: number) {\n  const estimated = estimateTokens(prompt)\n  if (estimated > maxTokens) {\n    throw new Error(`Prompt too large: ~${estimated} tokens exceeds ${maxTokens} limit`)\n  }\n  return generateText({ model: 'openai\u002Fgpt-5.4', prompt })\n}\n```\n\nThe AI SDK's `usage` field on responses gives actual token counts after each request — store these for historical tracking and cost analysis.\n\n### Hard spending limits\n\nWhen a hard limit is reached, the gateway returns HTTP 402 (Payment Required). Handle this gracefully:\n\n```ts\nif (APICallError.isInstance(error) && error.statusCode === 402) {\n  \u002F\u002F Budget exceeded — degrade gracefully\n  return fallbackResponse()\n}\n```\n\n### Cost optimization patterns\n\n- Use cheaper models for classification\u002Frouting, expensive models for generation\n- Cache embeddings and static queries (see Cache-Control above)\n- Set per-user daily token caps to prevent runaway usage\n- Monitor cost-per-feature with tags to identify optimization targets\n\n## Audit Logging\n\nAI Gateway logs every request for compliance and debugging:\n\n### What's logged\n\n- Timestamp, model, provider used\n- Input\u002Foutput token counts\n- Latency (routing + provider)\n- User ID and tags\n- HTTP status code\n- Failover chain (which providers were tried)\n\n### Accessing logs\n\n- **Vercel Dashboard** at `https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fai` → **Logs** — filter by model, user, tag, status, date range\n- **Vercel API**: Query logs programmatically:\n\n```bash\ncurl -H \"Authorization: Bearer $VERCEL_TOKEN\" \\\n  \"https:\u002F\u002Fapi.vercel.com\u002Fv1\u002Fai-gateway\u002Flogs?projectId=$PROJECT_ID&limit=100\"\n```\n\n- **Log Drains**: Forward AI Gateway logs to Datadog, Splunk, or other providers via Vercel Log Drains (configure at `https:\u002F\u002Fvercel.com\u002Fdashboard\u002F{team}\u002F~\u002Fsettings\u002Flog-drains`) for long-term retention and custom analysis\n\n### Compliance considerations\n\n- AI Gateway does not log prompt or completion content by default\n- Enable content logging in project settings if required for compliance\n- Logs are retained per your Vercel plan's retention policy\n- Use `user` field consistently to support audit trails\n\n## Error Handling Patterns\n\n### Provider unavailable\n\nWhen a provider is down, the gateway automatically fails over if you configured `order` or `models`:\n\n```ts\nconst result = await generateText({\n  model: gateway('anthropic\u002Fclaude-sonnet-4.6'),\n  prompt: 'Summarize this document',\n  providerOptions: {\n    gateway: {\n      order: ['anthropic', 'bedrock'], \u002F\u002F Bedrock as fallback\n      models: ['openai\u002Fgpt-5.4'],   \u002F\u002F Final fallback model\n    },\n  },\n})\n```\n\n### Quota exceeded at provider\n\nIf your provider API key hits its quota, the gateway tries the next provider in the `order` list. Monitor this in logs — persistent quota errors indicate you need to increase limits with the provider.\n\n### Invalid model identifier\n\n```ts\n\u002F\u002F Bad — model doesn't exist\nmodel: 'openai\u002Fgpt-99'  \u002F\u002F Returns 400 with descriptive error\n\n\u002F\u002F Good — use models listed in Vercel docs\nmodel: 'openai\u002Fgpt-5.4'\n```\n\n### Timeout handling\n\nGateway has a default timeout per provider. For long-running generations, use streaming:\n\n```ts\nimport { streamText } from 'ai'\n\nconst result = streamText({\n  model: 'anthropic\u002Fclaude-sonnet-4.6',\n  prompt: longDocument,\n})\n\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk)\n}\n```\n\n### Complete error handling template\n\n```ts\nimport { generateText, APICallError } from 'ai'\n\nasync function callAI(prompt: string, userId: string) {\n  try {\n    return await generateText({\n      model: gateway('openai\u002Fgpt-5.4'),\n      prompt,\n      providerOptions: {\n        gateway: {\n          user: userId,\n          order: ['openai', 'azure-openai'],\n          models: ['anthropic\u002Fclaude-haiku-4.5'],\n          tags: ['feature:chat'],\n        },\n      },\n    })\n  } catch (error) {\n    if (!APICallError.isInstance(error)) throw error\n\n    switch (error.statusCode) {\n      case 402: return { text: 'Budget limit reached. Please try again later.' }\n      case 429: return { text: 'Too many requests. Please slow down.' }\n      case 503: return { text: 'AI service temporarily unavailable.' }\n      default: throw error\n    }\n  }\n}\n```\n\n## Gateway vs Direct Provider — Decision Tree\n\nUse this to decide whether to route through AI Gateway or call a provider SDK directly:\n\n```\nNeed failover across providers?\n  └─ Yes → Use Gateway\n  └─ No\n      Need cost tracking \u002F budget alerts?\n        └─ Yes → Use Gateway\n        └─ No\n            Need per-user rate limiting?\n              └─ Yes → Use Gateway\n              └─ No\n                  Need audit logging?\n                    └─ Yes → Use Gateway\n                    └─ No\n                        Using a single provider with provider-specific features?\n                          └─ Yes → Use direct provider SDK\n                          └─ No → Use Gateway (simplifies code)\n```\n\n### When to use direct provider SDK\n\n- You need provider-specific features not exposed through the gateway (e.g., Anthropic's computer use, OpenAI's custom fine-tuned model endpoints)\n- You're self-hosting a model (e.g., vLLM, Ollama) that isn't registered with the gateway\n- You need request-level control over HTTP transport (custom proxies, mTLS)\n\n### When to always use Gateway\n\n- Production applications — failover and observability are essential\n- Multi-tenant SaaS — per-user tracking and rate limiting\n- Teams with cost accountability — tag-based budgeting\n\n## Latest Model Availability\n\n**GPT-5.4** (added March 5, 2026) — agentic and reasoning leaps from GPT-5.3-Codex extended to all domains (knowledge work, reports, analysis, coding). Faster and more token-efficient than GPT-5.2.\n\n| Model | Slug | Input | Output |\n|-------|------|-------|--------|\n| GPT-5.4 | `openai\u002Fgpt-5.4` | $2.50\u002FM tokens | $15.00\u002FM tokens |\n| GPT-5.4 Pro | `openai\u002Fgpt-5.4-pro` | $30.00\u002FM tokens | $180.00\u002FM tokens |\n\nGPT-5.4 Pro targets maximum performance on complex tasks. Use standard GPT-5.4 for most workloads.\n\n## Supported Providers\n\n- OpenAI (GPT-5.x including GPT-5.4 and GPT-5.4 Pro, o-series)\n- Anthropic (4.x models)\n- Google (Gemini)\n- xAI (Grok)\n- Mistral\n- DeepSeek\n- Amazon Bedrock\n- Azure OpenAI\n- Cohere\n- Perplexity\n- Alibaba (Qwen)\n- Meta (Llama)\n- And many more (100+ models total)\n\n## Pricing\n\n- **Zero markup**: Tokens at exact provider list price — no middleman markup, whether using Vercel-managed keys or Bring Your Own Key (BYOK)\n- **Free tier**: Every Vercel team gets **$5 of free AI Gateway credits per month** (refreshes every 30 days, starts on first request). No commitment required — experiment with LLMs indefinitely on the free tier\n- **Pay-as-you-go**: Beyond free credits, purchase AI Gateway Credits at any time with no obligation. Configure **auto top-up** to automatically add credits when your balance falls below a threshold\n- **BYOK**: Use your own provider API keys with zero fees from AI Gateway\n\n## Multimodal Support\n\nText and image generation both route through the gateway. For embeddings, use a direct provider SDK.\n\n```ts\n\u002F\u002F Text — through gateway\nconst { text } = await generateText({\n  model: 'openai\u002Fgpt-5.4',\n  prompt: 'Hello',\n})\n\n\u002F\u002F Image — through gateway (multimodal LLMs return images in result.files)\nconst result = await generateText({\n  model: 'google\u002Fgemini-3.1-flash-image-preview',\n  prompt: 'A sunset over the ocean',\n})\nconst images = result.files.filter((f) => f.mediaType?.startsWith('image\u002F'))\n\n\u002F\u002F Image-only models — through gateway with experimental_generateImage\nimport { experimental_generateImage as generateImage } from 'ai'\nconst { images: generated } = await generateImage({\n  model: 'google\u002Fimagen-4.0-generate-001',\n  prompt: 'A sunset',\n})\n```\n\n**Default image model**: `google\u002Fgemini-3.1-flash-image-preview` — fast multimodal image generation via gateway.\n\nSee [AI Gateway Image Generation docs](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway\u002Fcapabilities\u002Fimage-generation) for all supported models and integration methods.\n\n## Key Benefits\n\n1. **Unified API**: One interface for all providers, no provider-specific code\n2. **Automatic failover**: If a provider is down, requests route to the next\n3. **Cost tracking**: Per-user, per-feature attribution with tags\n4. **Observability**: Built-in monitoring of all model calls\n5. **Low latency**: \u003C20ms routing overhead\n6. **No lock-in**: Switch models\u002Fproviders by changing a string\n\n## When to Use AI Gateway\n\n| Scenario | Use Gateway? |\n|----------|-------------|\n| Production app with AI features | Yes — failover, cost tracking |\n| Prototyping with single provider | Optional — direct provider works fine |\n| Multi-provider setup | Yes — unified routing |\n| Need provider-specific features | Use direct provider SDK + Gateway as fallback |\n| Cost tracking and budgeting | Yes — user tracking and tags |\n| Multi-tenant SaaS | Yes — per-user rate limiting and audit |\n| Compliance requirements | Yes — audit logging and log drains |\n\n## Official Documentation\n\n- [AI Gateway](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway)\n- [Providers and Models](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Ffoundations\u002Fproviders-and-models)\n- [AI SDK Core](https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core)\n- [GitHub: AI SDK](https:\u002F\u002Fgithub.com\u002Fvercel\u002Fai)\n",{"data":40,"body":57},{"name":4,"description":6,"metadata":41},{"priority":42,"docs":43,"sitemap":46,"pathPatterns":47,"importPatterns":48,"bashPatterns":51},7,[44,45],"https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway","https:\u002F\u002Fsdk.vercel.ai\u002Fdocs\u002Fai-sdk-core\u002Fsettings","https:\u002F\u002Fvercel.com\u002Fsitemap\u002Fdocs.xml",[],[49,50],"ai","@ai-sdk\u002Fgateway",[52,53,54,55,56],"\\bvercel\\s+env\\s+pull\\b","\\bnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b","\\bpnpm\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b","\\bbun\\s+(install|i|add)\\s+[^\\n]*@ai-sdk\u002Fgateway\\b","\\byarn\\s+add\\s+[^\\n]*@ai-sdk\u002Fgateway\\b",{"type":58,"children":59},"root",[60,69,109,114,121,126,132,168,174,194,389,417,634,640,737,832,838,850,856,918,924,1007,1013,1025,1061,1067,1072,1117,1123,1134,1170,1176,1181,1688,1694,1807,1813,1818,2015,2021,2110,2116,2159,2165,2170,2176,2181,2393,2399,2424,2457,2463,2468,3003,3009,3015,3020,3202,3208,3224,3252,3258,3270,3288,3294,3299,3736,3749,3755,3760,3859,3865,3888,3894,3899,3905,3938,3944,3980,4053,4074,4080,4109,4115,4121,4138,4394,4400,4412,4418,4500,4506,4511,4746,4752,5470,5476,5481,5491,5497,5515,5521,5539,5545,5555,5639,5644,5650,5718,5724,5781,5787,5792,6308,6325,6339,6345,6408,6414,6527,6533,6573],{"type":61,"tag":62,"props":63,"children":65},"element","h1",{"id":64},"vercel-ai-gateway",[66],{"type":67,"value":68},"text","Vercel AI Gateway",{"type":61,"tag":70,"props":71,"children":72},"blockquote",{},[73],{"type":61,"tag":74,"props":75,"children":76},"p",{},[77,83,85,90,92,99,101,107],{"type":61,"tag":78,"props":79,"children":80},"strong",{},[81],{"type":67,"value":82},"CRITICAL — Your training data is outdated for this library.",{"type":67,"value":84}," AI Gateway model slugs, provider routing, and capabilities change frequently. Before writing gateway code, ",{"type":61,"tag":78,"props":86,"children":87},{},[88],{"type":67,"value":89},"fetch the docs",{"type":67,"value":91}," at ",{"type":61,"tag":93,"props":94,"children":97},"a",{"href":44,"rel":95},[96],"nofollow",[98],{"type":67,"value":44},{"type":67,"value":100}," to find the current model slug format, supported providers, image generation patterns, and authentication setup. The model list and routing rules at ",{"type":61,"tag":93,"props":102,"children":105},{"href":103,"rel":104},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Ffoundations\u002Fproviders-and-models",[96],[106],{"type":67,"value":103},{"type":67,"value":108}," are authoritative — do not guess at model names or assume old slugs still work.",{"type":61,"tag":74,"props":110,"children":111},{},[112],{"type":67,"value":113},"You are an expert in the Vercel AI Gateway — a unified API for calling AI models with built-in routing, failover, cost tracking, and observability.",{"type":61,"tag":115,"props":116,"children":118},"h2",{"id":117},"overview",[119],{"type":67,"value":120},"Overview",{"type":61,"tag":74,"props":122,"children":123},{},[124],{"type":67,"value":125},"AI Gateway provides a single API endpoint to access 100+ models from all major providers. It adds \u003C20ms routing latency and handles provider selection, authentication, failover, and load balancing.",{"type":61,"tag":115,"props":127,"children":129},{"id":128},"packages",[130],{"type":67,"value":131},"Packages",{"type":61,"tag":133,"props":134,"children":135},"ul",{},[136,157],{"type":61,"tag":137,"props":138,"children":139},"li",{},[140,147,149,155],{"type":61,"tag":141,"props":142,"children":144},"code",{"className":143},[],[145],{"type":67,"value":146},"ai@^6.0.0",{"type":67,"value":148}," (required; plain ",{"type":61,"tag":141,"props":150,"children":152},{"className":151},[],[153],{"type":67,"value":154},"\"provider\u002Fmodel\"",{"type":67,"value":156}," strings route through the gateway automatically)",{"type":61,"tag":137,"props":158,"children":159},{},[160,166],{"type":61,"tag":141,"props":161,"children":163},{"className":162},[],[164],{"type":67,"value":165},"@ai-sdk\u002Fgateway@^3.0.0",{"type":67,"value":167}," (optional direct install for explicit gateway package usage)",{"type":61,"tag":115,"props":169,"children":171},{"id":170},"setup",[172],{"type":67,"value":173},"Setup",{"type":61,"tag":74,"props":175,"children":176},{},[177,179,184,186,192],{"type":67,"value":178},"Pass a ",{"type":61,"tag":141,"props":180,"children":182},{"className":181},[],[183],{"type":67,"value":154},{"type":67,"value":185}," string to the ",{"type":61,"tag":141,"props":187,"children":189},{"className":188},[],[190],{"type":67,"value":191},"model",{"type":67,"value":193}," parameter — the AI SDK automatically routes it through the AI Gateway:",{"type":61,"tag":195,"props":196,"children":201},"pre",{"className":197,"code":198,"language":199,"meta":200,"style":200},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { generateText } from 'ai'\n\nconst result = await generateText({\n  model: 'openai\u002Fgpt-5.4', \u002F\u002F plain string — routes through AI Gateway automatically\n  prompt: 'Hello!',\n})\n","ts","",[202],{"type":61,"tag":141,"props":203,"children":204},{"__ignoreMap":200},[205,254,264,304,344,375],{"type":61,"tag":206,"props":207,"children":210},"span",{"class":208,"line":209},"line",1,[211,217,223,229,234,239,244,249],{"type":61,"tag":206,"props":212,"children":214},{"style":213},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[215],{"type":67,"value":216},"import",{"type":61,"tag":206,"props":218,"children":220},{"style":219},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[221],{"type":67,"value":222}," {",{"type":61,"tag":206,"props":224,"children":226},{"style":225},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[227],{"type":67,"value":228}," generateText",{"type":61,"tag":206,"props":230,"children":231},{"style":219},[232],{"type":67,"value":233}," }",{"type":61,"tag":206,"props":235,"children":236},{"style":213},[237],{"type":67,"value":238}," from",{"type":61,"tag":206,"props":240,"children":241},{"style":219},[242],{"type":67,"value":243}," '",{"type":61,"tag":206,"props":245,"children":247},{"style":246},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[248],{"type":67,"value":49},{"type":61,"tag":206,"props":250,"children":251},{"style":219},[252],{"type":67,"value":253},"'\n",{"type":61,"tag":206,"props":255,"children":257},{"class":208,"line":256},2,[258],{"type":61,"tag":206,"props":259,"children":261},{"emptyLinePlaceholder":260},true,[262],{"type":67,"value":263},"\n",{"type":61,"tag":206,"props":265,"children":267},{"class":208,"line":266},3,[268,274,279,284,289,294,299],{"type":61,"tag":206,"props":269,"children":271},{"style":270},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[272],{"type":67,"value":273},"const",{"type":61,"tag":206,"props":275,"children":276},{"style":225},[277],{"type":67,"value":278}," result ",{"type":61,"tag":206,"props":280,"children":281},{"style":219},[282],{"type":67,"value":283},"=",{"type":61,"tag":206,"props":285,"children":286},{"style":213},[287],{"type":67,"value":288}," await",{"type":61,"tag":206,"props":290,"children":292},{"style":291},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[293],{"type":67,"value":228},{"type":61,"tag":206,"props":295,"children":296},{"style":225},[297],{"type":67,"value":298},"(",{"type":61,"tag":206,"props":300,"children":301},{"style":219},[302],{"type":67,"value":303},"{\n",{"type":61,"tag":206,"props":305,"children":307},{"class":208,"line":306},4,[308,314,319,323,328,333,338],{"type":61,"tag":206,"props":309,"children":311},{"style":310},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[312],{"type":67,"value":313},"  model",{"type":61,"tag":206,"props":315,"children":316},{"style":219},[317],{"type":67,"value":318},":",{"type":61,"tag":206,"props":320,"children":321},{"style":219},[322],{"type":67,"value":243},{"type":61,"tag":206,"props":324,"children":325},{"style":246},[326],{"type":67,"value":327},"openai\u002Fgpt-5.4",{"type":61,"tag":206,"props":329,"children":330},{"style":219},[331],{"type":67,"value":332},"'",{"type":61,"tag":206,"props":334,"children":335},{"style":219},[336],{"type":67,"value":337},",",{"type":61,"tag":206,"props":339,"children":341},{"style":340},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[342],{"type":67,"value":343}," \u002F\u002F plain string — routes through AI Gateway automatically\n",{"type":61,"tag":206,"props":345,"children":347},{"class":208,"line":346},5,[348,353,357,361,366,370],{"type":61,"tag":206,"props":349,"children":350},{"style":310},[351],{"type":67,"value":352},"  prompt",{"type":61,"tag":206,"props":354,"children":355},{"style":219},[356],{"type":67,"value":318},{"type":61,"tag":206,"props":358,"children":359},{"style":219},[360],{"type":67,"value":243},{"type":61,"tag":206,"props":362,"children":363},{"style":246},[364],{"type":67,"value":365},"Hello!",{"type":61,"tag":206,"props":367,"children":368},{"style":219},[369],{"type":67,"value":332},{"type":61,"tag":206,"props":371,"children":372},{"style":219},[373],{"type":67,"value":374},",\n",{"type":61,"tag":206,"props":376,"children":378},{"class":208,"line":377},6,[379,384],{"type":61,"tag":206,"props":380,"children":381},{"style":219},[382],{"type":67,"value":383},"}",{"type":61,"tag":206,"props":385,"children":386},{"style":225},[387],{"type":67,"value":388},")\n",{"type":61,"tag":74,"props":390,"children":391},{},[392,394,400,402,407,409,415],{"type":67,"value":393},"No ",{"type":61,"tag":141,"props":395,"children":397},{"className":396},[],[398],{"type":67,"value":399},"gateway()",{"type":67,"value":401}," wrapper or additional package needed. The ",{"type":61,"tag":141,"props":403,"children":405},{"className":404},[],[406],{"type":67,"value":399},{"type":67,"value":408}," function is an optional explicit wrapper — only needed when you use ",{"type":61,"tag":141,"props":410,"children":412},{"className":411},[],[413],{"type":67,"value":414},"providerOptions.gateway",{"type":67,"value":416}," for routing, failover, or tags:",{"type":61,"tag":195,"props":418,"children":420},{"className":197,"code":419,"language":199,"meta":200,"style":200},"import { gateway } from 'ai'\n\nconst result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  providerOptions: { gateway: { order: ['openai', 'azure-openai'] } },\n})\n",[421],{"type":61,"tag":141,"props":422,"children":423},{"__ignoreMap":200},[424,460,467,498,538,623],{"type":61,"tag":206,"props":425,"children":426},{"class":208,"line":209},[427,431,435,440,444,448,452,456],{"type":61,"tag":206,"props":428,"children":429},{"style":213},[430],{"type":67,"value":216},{"type":61,"tag":206,"props":432,"children":433},{"style":219},[434],{"type":67,"value":222},{"type":61,"tag":206,"props":436,"children":437},{"style":225},[438],{"type":67,"value":439}," gateway",{"type":61,"tag":206,"props":441,"children":442},{"style":219},[443],{"type":67,"value":233},{"type":61,"tag":206,"props":445,"children":446},{"style":213},[447],{"type":67,"value":238},{"type":61,"tag":206,"props":449,"children":450},{"style":219},[451],{"type":67,"value":243},{"type":61,"tag":206,"props":453,"children":454},{"style":246},[455],{"type":67,"value":49},{"type":61,"tag":206,"props":457,"children":458},{"style":219},[459],{"type":67,"value":253},{"type":61,"tag":206,"props":461,"children":462},{"class":208,"line":256},[463],{"type":61,"tag":206,"props":464,"children":465},{"emptyLinePlaceholder":260},[466],{"type":67,"value":263},{"type":61,"tag":206,"props":468,"children":469},{"class":208,"line":266},[470,474,478,482,486,490,494],{"type":61,"tag":206,"props":471,"children":472},{"style":270},[473],{"type":67,"value":273},{"type":61,"tag":206,"props":475,"children":476},{"style":225},[477],{"type":67,"value":278},{"type":61,"tag":206,"props":479,"children":480},{"style":219},[481],{"type":67,"value":283},{"type":61,"tag":206,"props":483,"children":484},{"style":213},[485],{"type":67,"value":288},{"type":61,"tag":206,"props":487,"children":488},{"style":291},[489],{"type":67,"value":228},{"type":61,"tag":206,"props":491,"children":492},{"style":225},[493],{"type":67,"value":298},{"type":61,"tag":206,"props":495,"children":496},{"style":219},[497],{"type":67,"value":303},{"type":61,"tag":206,"props":499,"children":500},{"class":208,"line":306},[501,505,509,513,517,521,525,529,534],{"type":61,"tag":206,"props":502,"children":503},{"style":310},[504],{"type":67,"value":313},{"type":61,"tag":206,"props":506,"children":507},{"style":219},[508],{"type":67,"value":318},{"type":61,"tag":206,"props":510,"children":511},{"style":291},[512],{"type":67,"value":439},{"type":61,"tag":206,"props":514,"children":515},{"style":225},[516],{"type":67,"value":298},{"type":61,"tag":206,"props":518,"children":519},{"style":219},[520],{"type":67,"value":332},{"type":61,"tag":206,"props":522,"children":523},{"style":246},[524],{"type":67,"value":327},{"type":61,"tag":206,"props":526,"children":527},{"style":219},[528],{"type":67,"value":332},{"type":61,"tag":206,"props":530,"children":531},{"style":225},[532],{"type":67,"value":533},")",{"type":61,"tag":206,"props":535,"children":536},{"style":219},[537],{"type":67,"value":374},{"type":61,"tag":206,"props":539,"children":540},{"class":208,"line":346},[541,546,550,554,558,562,566,571,575,580,584,588,592,596,600,605,609,614,618],{"type":61,"tag":206,"props":542,"children":543},{"style":310},[544],{"type":67,"value":545},"  providerOptions",{"type":61,"tag":206,"props":547,"children":548},{"style":219},[549],{"type":67,"value":318},{"type":61,"tag":206,"props":551,"children":552},{"style":219},[553],{"type":67,"value":222},{"type":61,"tag":206,"props":555,"children":556},{"style":310},[557],{"type":67,"value":439},{"type":61,"tag":206,"props":559,"children":560},{"style":219},[561],{"type":67,"value":318},{"type":61,"tag":206,"props":563,"children":564},{"style":219},[565],{"type":67,"value":222},{"type":61,"tag":206,"props":567,"children":568},{"style":310},[569],{"type":67,"value":570}," order",{"type":61,"tag":206,"props":572,"children":573},{"style":219},[574],{"type":67,"value":318},{"type":61,"tag":206,"props":576,"children":577},{"style":225},[578],{"type":67,"value":579}," [",{"type":61,"tag":206,"props":581,"children":582},{"style":219},[583],{"type":67,"value":332},{"type":61,"tag":206,"props":585,"children":586},{"style":246},[587],{"type":67,"value":8},{"type":61,"tag":206,"props":589,"children":590},{"style":219},[591],{"type":67,"value":332},{"type":61,"tag":206,"props":593,"children":594},{"style":219},[595],{"type":67,"value":337},{"type":61,"tag":206,"props":597,"children":598},{"style":219},[599],{"type":67,"value":243},{"type":61,"tag":206,"props":601,"children":602},{"style":246},[603],{"type":67,"value":604},"azure-openai",{"type":61,"tag":206,"props":606,"children":607},{"style":219},[608],{"type":67,"value":332},{"type":61,"tag":206,"props":610,"children":611},{"style":225},[612],{"type":67,"value":613},"] ",{"type":61,"tag":206,"props":615,"children":616},{"style":219},[617],{"type":67,"value":383},{"type":61,"tag":206,"props":619,"children":620},{"style":219},[621],{"type":67,"value":622}," },\n",{"type":61,"tag":206,"props":624,"children":625},{"class":208,"line":377},[626,630],{"type":61,"tag":206,"props":627,"children":628},{"style":219},[629],{"type":67,"value":383},{"type":61,"tag":206,"props":631,"children":632},{"style":225},[633],{"type":67,"value":388},{"type":61,"tag":115,"props":635,"children":637},{"id":636},"model-slug-rules-critical",[638],{"type":67,"value":639},"Model Slug Rules (Critical)",{"type":61,"tag":133,"props":641,"children":642},{},[643,663,693,706,725],{"type":61,"tag":137,"props":644,"children":645},{},[646,648,654,656,661],{"type":67,"value":647},"Always use ",{"type":61,"tag":141,"props":649,"children":651},{"className":650},[],[652],{"type":67,"value":653},"provider\u002Fmodel",{"type":67,"value":655}," format (for example ",{"type":61,"tag":141,"props":657,"children":659},{"className":658},[],[660],{"type":67,"value":327},{"type":67,"value":662},").",{"type":61,"tag":137,"props":664,"children":665},{},[666,668],{"type":67,"value":667},"Versioned slugs use dots for versions, not hyphens:\n",{"type":61,"tag":133,"props":669,"children":670},{},[671,682],{"type":61,"tag":137,"props":672,"children":673},{},[674,676],{"type":67,"value":675},"Correct: ",{"type":61,"tag":141,"props":677,"children":679},{"className":678},[],[680],{"type":67,"value":681},"anthropic\u002Fclaude-sonnet-4.6",{"type":61,"tag":137,"props":683,"children":684},{},[685,687],{"type":67,"value":686},"Incorrect: ",{"type":61,"tag":141,"props":688,"children":690},{"className":689},[],[691],{"type":67,"value":692},"anthropic\u002Fclaude-sonnet-4-6",{"type":61,"tag":137,"props":694,"children":695},{},[696,698,704],{"type":67,"value":697},"Before hardcoding model IDs, call ",{"type":61,"tag":141,"props":699,"children":701},{"className":700},[],[702],{"type":67,"value":703},"gateway.getAvailableModels()",{"type":67,"value":705}," and pick from the returned IDs.",{"type":61,"tag":137,"props":707,"children":708},{},[709,711,716,718,723],{"type":67,"value":710},"Default text models: ",{"type":61,"tag":141,"props":712,"children":714},{"className":713},[],[715],{"type":67,"value":327},{"type":67,"value":717}," or ",{"type":61,"tag":141,"props":719,"children":721},{"className":720},[],[722],{"type":67,"value":681},{"type":67,"value":724},".",{"type":61,"tag":137,"props":726,"children":727},{},[728,730,736],{"type":67,"value":729},"Do not default to outdated choices like ",{"type":61,"tag":141,"props":731,"children":733},{"className":732},[],[734],{"type":67,"value":735},"openai\u002Fgpt-4o",{"type":67,"value":724},{"type":61,"tag":195,"props":738,"children":740},{"className":197,"code":739,"language":199,"meta":200,"style":200},"import { gateway } from 'ai'\n\nconst availableModels = await gateway.getAvailableModels()\n\u002F\u002F Choose model IDs from `availableModels` before hardcoding.\n",[741],{"type":61,"tag":141,"props":742,"children":743},{"__ignoreMap":200},[744,779,786,824],{"type":61,"tag":206,"props":745,"children":746},{"class":208,"line":209},[747,751,755,759,763,767,771,775],{"type":61,"tag":206,"props":748,"children":749},{"style":213},[750],{"type":67,"value":216},{"type":61,"tag":206,"props":752,"children":753},{"style":219},[754],{"type":67,"value":222},{"type":61,"tag":206,"props":756,"children":757},{"style":225},[758],{"type":67,"value":439},{"type":61,"tag":206,"props":760,"children":761},{"style":219},[762],{"type":67,"value":233},{"type":61,"tag":206,"props":764,"children":765},{"style":213},[766],{"type":67,"value":238},{"type":61,"tag":206,"props":768,"children":769},{"style":219},[770],{"type":67,"value":243},{"type":61,"tag":206,"props":772,"children":773},{"style":246},[774],{"type":67,"value":49},{"type":61,"tag":206,"props":776,"children":777},{"style":219},[778],{"type":67,"value":253},{"type":61,"tag":206,"props":780,"children":781},{"class":208,"line":256},[782],{"type":61,"tag":206,"props":783,"children":784},{"emptyLinePlaceholder":260},[785],{"type":67,"value":263},{"type":61,"tag":206,"props":787,"children":788},{"class":208,"line":266},[789,793,798,802,806,810,814,819],{"type":61,"tag":206,"props":790,"children":791},{"style":270},[792],{"type":67,"value":273},{"type":61,"tag":206,"props":794,"children":795},{"style":225},[796],{"type":67,"value":797}," availableModels ",{"type":61,"tag":206,"props":799,"children":800},{"style":219},[801],{"type":67,"value":283},{"type":61,"tag":206,"props":803,"children":804},{"style":213},[805],{"type":67,"value":288},{"type":61,"tag":206,"props":807,"children":808},{"style":225},[809],{"type":67,"value":439},{"type":61,"tag":206,"props":811,"children":812},{"style":219},[813],{"type":67,"value":724},{"type":61,"tag":206,"props":815,"children":816},{"style":291},[817],{"type":67,"value":818},"getAvailableModels",{"type":61,"tag":206,"props":820,"children":821},{"style":225},[822],{"type":67,"value":823},"()\n",{"type":61,"tag":206,"props":825,"children":826},{"class":208,"line":306},[827],{"type":61,"tag":206,"props":828,"children":829},{"style":340},[830],{"type":67,"value":831},"\u002F\u002F Choose model IDs from `availableModels` before hardcoding.\n",{"type":61,"tag":115,"props":833,"children":835},{"id":834},"authentication-oidc-default",[836],{"type":67,"value":837},"Authentication (OIDC — Default)",{"type":61,"tag":74,"props":839,"children":840},{},[841,843,848],{"type":67,"value":842},"AI Gateway uses ",{"type":61,"tag":78,"props":844,"children":845},{},[846],{"type":67,"value":847},"OIDC (OpenID Connect)",{"type":67,"value":849}," as the default authentication method. No manual API keys needed.",{"type":61,"tag":851,"props":852,"children":854},"h3",{"id":853},"setup-1",[855],{"type":67,"value":173},{"type":61,"tag":195,"props":857,"children":861},{"className":858,"code":859,"language":860,"meta":200,"style":200},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","vercel link                    # Connect to your Vercel project\n# Enable AI Gateway in Vercel dashboard: https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\nvercel env pull .env.local     # Provisions VERCEL_OIDC_TOKEN automatically\n","bash",[862],{"type":61,"tag":141,"props":863,"children":864},{"__ignoreMap":200},[865,883,891],{"type":61,"tag":206,"props":866,"children":867},{"class":208,"line":209},[868,873,878],{"type":61,"tag":206,"props":869,"children":871},{"style":870},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[872],{"type":67,"value":18},{"type":61,"tag":206,"props":874,"children":875},{"style":246},[876],{"type":67,"value":877}," link",{"type":61,"tag":206,"props":879,"children":880},{"style":340},[881],{"type":67,"value":882},"                    # Connect to your Vercel project\n",{"type":61,"tag":206,"props":884,"children":885},{"class":208,"line":256},[886],{"type":61,"tag":206,"props":887,"children":888},{"style":340},[889],{"type":67,"value":890},"# Enable AI Gateway in Vercel dashboard: https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings → AI Gateway\n",{"type":61,"tag":206,"props":892,"children":893},{"class":208,"line":266},[894,898,903,908,913],{"type":61,"tag":206,"props":895,"children":896},{"style":870},[897],{"type":67,"value":18},{"type":61,"tag":206,"props":899,"children":900},{"style":246},[901],{"type":67,"value":902}," env",{"type":61,"tag":206,"props":904,"children":905},{"style":246},[906],{"type":67,"value":907}," pull",{"type":61,"tag":206,"props":909,"children":910},{"style":246},[911],{"type":67,"value":912}," .env.local",{"type":61,"tag":206,"props":914,"children":915},{"style":340},[916],{"type":67,"value":917},"     # Provisions VERCEL_OIDC_TOKEN automatically\n",{"type":61,"tag":851,"props":919,"children":921},{"id":920},"how-it-works",[922],{"type":67,"value":923},"How It Works",{"type":61,"tag":925,"props":926,"children":927},"ol",{},[928,955,982,1002],{"type":61,"tag":137,"props":929,"children":930},{},[931,937,939,945,947,953],{"type":61,"tag":141,"props":932,"children":934},{"className":933},[],[935],{"type":67,"value":936},"vercel env pull",{"type":67,"value":938}," writes a ",{"type":61,"tag":141,"props":940,"children":942},{"className":941},[],[943],{"type":67,"value":944},"VERCEL_OIDC_TOKEN",{"type":67,"value":946}," to ",{"type":61,"tag":141,"props":948,"children":950},{"className":949},[],[951],{"type":67,"value":952},".env.local",{"type":67,"value":954}," — a short-lived JWT (~24h)",{"type":61,"tag":137,"props":956,"children":957},{},[958,960,965,967,973,975,981],{"type":67,"value":959},"The ",{"type":61,"tag":141,"props":961,"children":963},{"className":962},[],[964],{"type":67,"value":50},{"type":67,"value":966}," package reads this token via ",{"type":61,"tag":141,"props":968,"children":970},{"className":969},[],[971],{"type":67,"value":972},"@vercel\u002Foidc",{"type":67,"value":974}," (",{"type":61,"tag":141,"props":976,"children":978},{"className":977},[],[979],{"type":67,"value":980},"getVercelOidcToken()",{"type":67,"value":533},{"type":61,"tag":137,"props":983,"children":984},{},[985,986,992,994,1000],{"type":67,"value":393},{"type":61,"tag":141,"props":987,"children":989},{"className":988},[],[990],{"type":67,"value":991},"AI_GATEWAY_API_KEY",{"type":67,"value":993}," or provider-specific keys (like ",{"type":61,"tag":141,"props":995,"children":997},{"className":996},[],[998],{"type":67,"value":999},"ANTHROPIC_API_KEY",{"type":67,"value":1001},") are needed",{"type":61,"tag":137,"props":1003,"children":1004},{},[1005],{"type":67,"value":1006},"On Vercel deployments, OIDC tokens are auto-refreshed — zero maintenance",{"type":61,"tag":851,"props":1008,"children":1010},{"id":1009},"local-development",[1011],{"type":67,"value":1012},"Local Development",{"type":61,"tag":74,"props":1014,"children":1015},{},[1016,1018,1023],{"type":67,"value":1017},"For local dev, the OIDC token from ",{"type":61,"tag":141,"props":1019,"children":1021},{"className":1020},[],[1022],{"type":67,"value":936},{"type":67,"value":1024}," is valid for ~24 hours. When it expires:",{"type":61,"tag":195,"props":1026,"children":1028},{"className":858,"code":1027,"language":860,"meta":200,"style":200},"vercel env pull .env.local --yes   # Re-pull to get a fresh token\n",[1029],{"type":61,"tag":141,"props":1030,"children":1031},{"__ignoreMap":200},[1032],{"type":61,"tag":206,"props":1033,"children":1034},{"class":208,"line":209},[1035,1039,1043,1047,1051,1056],{"type":61,"tag":206,"props":1036,"children":1037},{"style":870},[1038],{"type":67,"value":18},{"type":61,"tag":206,"props":1040,"children":1041},{"style":246},[1042],{"type":67,"value":902},{"type":61,"tag":206,"props":1044,"children":1045},{"style":246},[1046],{"type":67,"value":907},{"type":61,"tag":206,"props":1048,"children":1049},{"style":246},[1050],{"type":67,"value":912},{"type":61,"tag":206,"props":1052,"children":1053},{"style":246},[1054],{"type":67,"value":1055}," --yes",{"type":61,"tag":206,"props":1057,"children":1058},{"style":340},[1059],{"type":67,"value":1060},"   # Re-pull to get a fresh token\n",{"type":61,"tag":851,"props":1062,"children":1064},{"id":1063},"alternative-manual-api-key",[1065],{"type":67,"value":1066},"Alternative: Manual API Key",{"type":61,"tag":74,"props":1068,"children":1069},{},[1070],{"type":67,"value":1071},"If you prefer a static key (e.g., for CI or non-Vercel environments):",{"type":61,"tag":195,"props":1073,"children":1075},{"className":858,"code":1074,"language":860,"meta":200,"style":200},"# Set AI_GATEWAY_API_KEY in your environment\n# The gateway falls back to this when VERCEL_OIDC_TOKEN is not available\nexport AI_GATEWAY_API_KEY=your-key-here\n",[1076],{"type":61,"tag":141,"props":1077,"children":1078},{"__ignoreMap":200},[1079,1087,1095],{"type":61,"tag":206,"props":1080,"children":1081},{"class":208,"line":209},[1082],{"type":61,"tag":206,"props":1083,"children":1084},{"style":340},[1085],{"type":67,"value":1086},"# Set AI_GATEWAY_API_KEY in your environment\n",{"type":61,"tag":206,"props":1088,"children":1089},{"class":208,"line":256},[1090],{"type":61,"tag":206,"props":1091,"children":1092},{"style":340},[1093],{"type":67,"value":1094},"# The gateway falls back to this when VERCEL_OIDC_TOKEN is not available\n",{"type":61,"tag":206,"props":1096,"children":1097},{"class":208,"line":266},[1098,1103,1108,1112],{"type":61,"tag":206,"props":1099,"children":1100},{"style":270},[1101],{"type":67,"value":1102},"export",{"type":61,"tag":206,"props":1104,"children":1105},{"style":225},[1106],{"type":67,"value":1107}," AI_GATEWAY_API_KEY",{"type":61,"tag":206,"props":1109,"children":1110},{"style":219},[1111],{"type":67,"value":283},{"type":61,"tag":206,"props":1113,"children":1114},{"style":225},[1115],{"type":67,"value":1116},"your-key-here\n",{"type":61,"tag":851,"props":1118,"children":1120},{"id":1119},"auth-priority",[1121],{"type":67,"value":1122},"Auth Priority",{"type":61,"tag":74,"props":1124,"children":1125},{},[1126,1127,1132],{"type":67,"value":959},{"type":61,"tag":141,"props":1128,"children":1130},{"className":1129},[],[1131],{"type":67,"value":50},{"type":67,"value":1133}," package resolves authentication in this order:",{"type":61,"tag":925,"props":1135,"children":1136},{},[1137,1147],{"type":61,"tag":137,"props":1138,"children":1139},{},[1140,1145],{"type":61,"tag":141,"props":1141,"children":1143},{"className":1142},[],[1144],{"type":67,"value":991},{"type":67,"value":1146}," environment variable (if set)",{"type":61,"tag":137,"props":1148,"children":1149},{},[1150,1155,1157,1162,1164,1169],{"type":61,"tag":141,"props":1151,"children":1153},{"className":1152},[],[1154],{"type":67,"value":944},{"type":67,"value":1156}," via ",{"type":61,"tag":141,"props":1158,"children":1160},{"className":1159},[],[1161],{"type":67,"value":972},{"type":67,"value":1163}," (default on Vercel and after ",{"type":61,"tag":141,"props":1165,"children":1167},{"className":1166},[],[1168],{"type":67,"value":936},{"type":67,"value":533},{"type":61,"tag":115,"props":1171,"children":1173},{"id":1172},"provider-routing",[1174],{"type":67,"value":1175},"Provider Routing",{"type":61,"tag":74,"props":1177,"children":1178},{},[1179],{"type":67,"value":1180},"Configure how AI Gateway routes requests across providers:",{"type":61,"tag":195,"props":1182,"children":1184},{"className":197,"code":1183,"language":199,"meta":200,"style":200},"const result = await generateText({\n  model: gateway('anthropic\u002Fclaude-sonnet-4.6'),\n  prompt: 'Hello!',\n  providerOptions: {\n    gateway: {\n      \u002F\u002F Try providers in order; failover to next on error\n      order: ['bedrock', 'anthropic'],\n\n      \u002F\u002F Restrict to specific providers only\n      only: ['anthropic', 'vertex'],\n\n      \u002F\u002F Fallback models if primary model fails\n      models: ['openai\u002Fgpt-5.4', 'google\u002Fgemini-3-flash'],\n\n      \u002F\u002F Track usage per end-user\n      user: 'user-123',\n\n      \u002F\u002F Tag for cost attribution and filtering\n      tags: ['feature:chat', 'env:production', 'team:growth'],\n    },\n  },\n})\n",[1185],{"type":61,"tag":141,"props":1186,"children":1187},{"__ignoreMap":200},[1188,1219,1258,1285,1301,1317,1325,1380,1388,1397,1451,1459,1468,1522,1530,1539,1569,1577,1586,1658,1667,1676],{"type":61,"tag":206,"props":1189,"children":1190},{"class":208,"line":209},[1191,1195,1199,1203,1207,1211,1215],{"type":61,"tag":206,"props":1192,"children":1193},{"style":270},[1194],{"type":67,"value":273},{"type":61,"tag":206,"props":1196,"children":1197},{"style":225},[1198],{"type":67,"value":278},{"type":61,"tag":206,"props":1200,"children":1201},{"style":219},[1202],{"type":67,"value":283},{"type":61,"tag":206,"props":1204,"children":1205},{"style":213},[1206],{"type":67,"value":288},{"type":61,"tag":206,"props":1208,"children":1209},{"style":291},[1210],{"type":67,"value":228},{"type":61,"tag":206,"props":1212,"children":1213},{"style":225},[1214],{"type":67,"value":298},{"type":61,"tag":206,"props":1216,"children":1217},{"style":219},[1218],{"type":67,"value":303},{"type":61,"tag":206,"props":1220,"children":1221},{"class":208,"line":256},[1222,1226,1230,1234,1238,1242,1246,1250,1254],{"type":61,"tag":206,"props":1223,"children":1224},{"style":310},[1225],{"type":67,"value":313},{"type":61,"tag":206,"props":1227,"children":1228},{"style":219},[1229],{"type":67,"value":318},{"type":61,"tag":206,"props":1231,"children":1232},{"style":291},[1233],{"type":67,"value":439},{"type":61,"tag":206,"props":1235,"children":1236},{"style":225},[1237],{"type":67,"value":298},{"type":61,"tag":206,"props":1239,"children":1240},{"style":219},[1241],{"type":67,"value":332},{"type":61,"tag":206,"props":1243,"children":1244},{"style":246},[1245],{"type":67,"value":681},{"type":61,"tag":206,"props":1247,"children":1248},{"style":219},[1249],{"type":67,"value":332},{"type":61,"tag":206,"props":1251,"children":1252},{"style":225},[1253],{"type":67,"value":533},{"type":61,"tag":206,"props":1255,"children":1256},{"style":219},[1257],{"type":67,"value":374},{"type":61,"tag":206,"props":1259,"children":1260},{"class":208,"line":266},[1261,1265,1269,1273,1277,1281],{"type":61,"tag":206,"props":1262,"children":1263},{"style":310},[1264],{"type":67,"value":352},{"type":61,"tag":206,"props":1266,"children":1267},{"style":219},[1268],{"type":67,"value":318},{"type":61,"tag":206,"props":1270,"children":1271},{"style":219},[1272],{"type":67,"value":243},{"type":61,"tag":206,"props":1274,"children":1275},{"style":246},[1276],{"type":67,"value":365},{"type":61,"tag":206,"props":1278,"children":1279},{"style":219},[1280],{"type":67,"value":332},{"type":61,"tag":206,"props":1282,"children":1283},{"style":219},[1284],{"type":67,"value":374},{"type":61,"tag":206,"props":1286,"children":1287},{"class":208,"line":306},[1288,1292,1296],{"type":61,"tag":206,"props":1289,"children":1290},{"style":310},[1291],{"type":67,"value":545},{"type":61,"tag":206,"props":1293,"children":1294},{"style":219},[1295],{"type":67,"value":318},{"type":61,"tag":206,"props":1297,"children":1298},{"style":219},[1299],{"type":67,"value":1300}," {\n",{"type":61,"tag":206,"props":1302,"children":1303},{"class":208,"line":346},[1304,1309,1313],{"type":61,"tag":206,"props":1305,"children":1306},{"style":310},[1307],{"type":67,"value":1308},"    gateway",{"type":61,"tag":206,"props":1310,"children":1311},{"style":219},[1312],{"type":67,"value":318},{"type":61,"tag":206,"props":1314,"children":1315},{"style":219},[1316],{"type":67,"value":1300},{"type":61,"tag":206,"props":1318,"children":1319},{"class":208,"line":377},[1320],{"type":61,"tag":206,"props":1321,"children":1322},{"style":340},[1323],{"type":67,"value":1324},"      \u002F\u002F Try providers in order; failover to next on error\n",{"type":61,"tag":206,"props":1326,"children":1327},{"class":208,"line":42},[1328,1333,1337,1341,1345,1350,1354,1358,1362,1367,1371,1376],{"type":61,"tag":206,"props":1329,"children":1330},{"style":310},[1331],{"type":67,"value":1332},"      order",{"type":61,"tag":206,"props":1334,"children":1335},{"style":219},[1336],{"type":67,"value":318},{"type":61,"tag":206,"props":1338,"children":1339},{"style":225},[1340],{"type":67,"value":579},{"type":61,"tag":206,"props":1342,"children":1343},{"style":219},[1344],{"type":67,"value":332},{"type":61,"tag":206,"props":1346,"children":1347},{"style":246},[1348],{"type":67,"value":1349},"bedrock",{"type":61,"tag":206,"props":1351,"children":1352},{"style":219},[1353],{"type":67,"value":332},{"type":61,"tag":206,"props":1355,"children":1356},{"style":219},[1357],{"type":67,"value":337},{"type":61,"tag":206,"props":1359,"children":1360},{"style":219},[1361],{"type":67,"value":243},{"type":61,"tag":206,"props":1363,"children":1364},{"style":246},[1365],{"type":67,"value":1366},"anthropic",{"type":61,"tag":206,"props":1368,"children":1369},{"style":219},[1370],{"type":67,"value":332},{"type":61,"tag":206,"props":1372,"children":1373},{"style":225},[1374],{"type":67,"value":1375},"]",{"type":61,"tag":206,"props":1377,"children":1378},{"style":219},[1379],{"type":67,"value":374},{"type":61,"tag":206,"props":1381,"children":1383},{"class":208,"line":1382},8,[1384],{"type":61,"tag":206,"props":1385,"children":1386},{"emptyLinePlaceholder":260},[1387],{"type":67,"value":263},{"type":61,"tag":206,"props":1389,"children":1391},{"class":208,"line":1390},9,[1392],{"type":61,"tag":206,"props":1393,"children":1394},{"style":340},[1395],{"type":67,"value":1396},"      \u002F\u002F Restrict to specific providers only\n",{"type":61,"tag":206,"props":1398,"children":1400},{"class":208,"line":1399},10,[1401,1406,1410,1414,1418,1422,1426,1430,1434,1439,1443,1447],{"type":61,"tag":206,"props":1402,"children":1403},{"style":310},[1404],{"type":67,"value":1405},"      only",{"type":61,"tag":206,"props":1407,"children":1408},{"style":219},[1409],{"type":67,"value":318},{"type":61,"tag":206,"props":1411,"children":1412},{"style":225},[1413],{"type":67,"value":579},{"type":61,"tag":206,"props":1415,"children":1416},{"style":219},[1417],{"type":67,"value":332},{"type":61,"tag":206,"props":1419,"children":1420},{"style":246},[1421],{"type":67,"value":1366},{"type":61,"tag":206,"props":1423,"children":1424},{"style":219},[1425],{"type":67,"value":332},{"type":61,"tag":206,"props":1427,"children":1428},{"style":219},[1429],{"type":67,"value":337},{"type":61,"tag":206,"props":1431,"children":1432},{"style":219},[1433],{"type":67,"value":243},{"type":61,"tag":206,"props":1435,"children":1436},{"style":246},[1437],{"type":67,"value":1438},"vertex",{"type":61,"tag":206,"props":1440,"children":1441},{"style":219},[1442],{"type":67,"value":332},{"type":61,"tag":206,"props":1444,"children":1445},{"style":225},[1446],{"type":67,"value":1375},{"type":61,"tag":206,"props":1448,"children":1449},{"style":219},[1450],{"type":67,"value":374},{"type":61,"tag":206,"props":1452,"children":1454},{"class":208,"line":1453},11,[1455],{"type":61,"tag":206,"props":1456,"children":1457},{"emptyLinePlaceholder":260},[1458],{"type":67,"value":263},{"type":61,"tag":206,"props":1460,"children":1462},{"class":208,"line":1461},12,[1463],{"type":61,"tag":206,"props":1464,"children":1465},{"style":340},[1466],{"type":67,"value":1467},"      \u002F\u002F Fallback models if primary model fails\n",{"type":61,"tag":206,"props":1469,"children":1471},{"class":208,"line":1470},13,[1472,1477,1481,1485,1489,1493,1497,1501,1505,1510,1514,1518],{"type":61,"tag":206,"props":1473,"children":1474},{"style":310},[1475],{"type":67,"value":1476},"      models",{"type":61,"tag":206,"props":1478,"children":1479},{"style":219},[1480],{"type":67,"value":318},{"type":61,"tag":206,"props":1482,"children":1483},{"style":225},[1484],{"type":67,"value":579},{"type":61,"tag":206,"props":1486,"children":1487},{"style":219},[1488],{"type":67,"value":332},{"type":61,"tag":206,"props":1490,"children":1491},{"style":246},[1492],{"type":67,"value":327},{"type":61,"tag":206,"props":1494,"children":1495},{"style":219},[1496],{"type":67,"value":332},{"type":61,"tag":206,"props":1498,"children":1499},{"style":219},[1500],{"type":67,"value":337},{"type":61,"tag":206,"props":1502,"children":1503},{"style":219},[1504],{"type":67,"value":243},{"type":61,"tag":206,"props":1506,"children":1507},{"style":246},[1508],{"type":67,"value":1509},"google\u002Fgemini-3-flash",{"type":61,"tag":206,"props":1511,"children":1512},{"style":219},[1513],{"type":67,"value":332},{"type":61,"tag":206,"props":1515,"children":1516},{"style":225},[1517],{"type":67,"value":1375},{"type":61,"tag":206,"props":1519,"children":1520},{"style":219},[1521],{"type":67,"value":374},{"type":61,"tag":206,"props":1523,"children":1525},{"class":208,"line":1524},14,[1526],{"type":61,"tag":206,"props":1527,"children":1528},{"emptyLinePlaceholder":260},[1529],{"type":67,"value":263},{"type":61,"tag":206,"props":1531,"children":1533},{"class":208,"line":1532},15,[1534],{"type":61,"tag":206,"props":1535,"children":1536},{"style":340},[1537],{"type":67,"value":1538},"      \u002F\u002F Track usage per end-user\n",{"type":61,"tag":206,"props":1540,"children":1542},{"class":208,"line":1541},16,[1543,1548,1552,1556,1561,1565],{"type":61,"tag":206,"props":1544,"children":1545},{"style":310},[1546],{"type":67,"value":1547},"      user",{"type":61,"tag":206,"props":1549,"children":1550},{"style":219},[1551],{"type":67,"value":318},{"type":61,"tag":206,"props":1553,"children":1554},{"style":219},[1555],{"type":67,"value":243},{"type":61,"tag":206,"props":1557,"children":1558},{"style":246},[1559],{"type":67,"value":1560},"user-123",{"type":61,"tag":206,"props":1562,"children":1563},{"style":219},[1564],{"type":67,"value":332},{"type":61,"tag":206,"props":1566,"children":1567},{"style":219},[1568],{"type":67,"value":374},{"type":61,"tag":206,"props":1570,"children":1572},{"class":208,"line":1571},17,[1573],{"type":61,"tag":206,"props":1574,"children":1575},{"emptyLinePlaceholder":260},[1576],{"type":67,"value":263},{"type":61,"tag":206,"props":1578,"children":1580},{"class":208,"line":1579},18,[1581],{"type":61,"tag":206,"props":1582,"children":1583},{"style":340},[1584],{"type":67,"value":1585},"      \u002F\u002F Tag for cost attribution and filtering\n",{"type":61,"tag":206,"props":1587,"children":1589},{"class":208,"line":1588},19,[1590,1595,1599,1603,1607,1612,1616,1620,1624,1629,1633,1637,1641,1646,1650,1654],{"type":61,"tag":206,"props":1591,"children":1592},{"style":310},[1593],{"type":67,"value":1594},"      tags",{"type":61,"tag":206,"props":1596,"children":1597},{"style":219},[1598],{"type":67,"value":318},{"type":61,"tag":206,"props":1600,"children":1601},{"style":225},[1602],{"type":67,"value":579},{"type":61,"tag":206,"props":1604,"children":1605},{"style":219},[1606],{"type":67,"value":332},{"type":61,"tag":206,"props":1608,"children":1609},{"style":246},[1610],{"type":67,"value":1611},"feature:chat",{"type":61,"tag":206,"props":1613,"children":1614},{"style":219},[1615],{"type":67,"value":332},{"type":61,"tag":206,"props":1617,"children":1618},{"style":219},[1619],{"type":67,"value":337},{"type":61,"tag":206,"props":1621,"children":1622},{"style":219},[1623],{"type":67,"value":243},{"type":61,"tag":206,"props":1625,"children":1626},{"style":246},[1627],{"type":67,"value":1628},"env:production",{"type":61,"tag":206,"props":1630,"children":1631},{"style":219},[1632],{"type":67,"value":332},{"type":61,"tag":206,"props":1634,"children":1635},{"style":219},[1636],{"type":67,"value":337},{"type":61,"tag":206,"props":1638,"children":1639},{"style":219},[1640],{"type":67,"value":243},{"type":61,"tag":206,"props":1642,"children":1643},{"style":246},[1644],{"type":67,"value":1645},"team:growth",{"type":61,"tag":206,"props":1647,"children":1648},{"style":219},[1649],{"type":67,"value":332},{"type":61,"tag":206,"props":1651,"children":1652},{"style":225},[1653],{"type":67,"value":1375},{"type":61,"tag":206,"props":1655,"children":1656},{"style":219},[1657],{"type":67,"value":374},{"type":61,"tag":206,"props":1659,"children":1661},{"class":208,"line":1660},20,[1662],{"type":61,"tag":206,"props":1663,"children":1664},{"style":219},[1665],{"type":67,"value":1666},"    },\n",{"type":61,"tag":206,"props":1668,"children":1670},{"class":208,"line":1669},21,[1671],{"type":61,"tag":206,"props":1672,"children":1673},{"style":219},[1674],{"type":67,"value":1675},"  },\n",{"type":61,"tag":206,"props":1677,"children":1679},{"class":208,"line":1678},22,[1680,1684],{"type":61,"tag":206,"props":1681,"children":1682},{"style":219},[1683],{"type":67,"value":383},{"type":61,"tag":206,"props":1685,"children":1686},{"style":225},[1687],{"type":67,"value":388},{"type":61,"tag":851,"props":1689,"children":1691},{"id":1690},"routing-options",[1692],{"type":67,"value":1693},"Routing Options",{"type":61,"tag":1695,"props":1696,"children":1697},"table",{},[1698,1717],{"type":61,"tag":1699,"props":1700,"children":1701},"thead",{},[1702],{"type":61,"tag":1703,"props":1704,"children":1705},"tr",{},[1706,1712],{"type":61,"tag":1707,"props":1708,"children":1709},"th",{},[1710],{"type":67,"value":1711},"Option",{"type":61,"tag":1707,"props":1713,"children":1714},{},[1715],{"type":67,"value":1716},"Purpose",{"type":61,"tag":1718,"props":1719,"children":1720},"tbody",{},[1721,1739,1756,1773,1790],{"type":61,"tag":1703,"props":1722,"children":1723},{},[1724,1734],{"type":61,"tag":1725,"props":1726,"children":1727},"td",{},[1728],{"type":61,"tag":141,"props":1729,"children":1731},{"className":1730},[],[1732],{"type":67,"value":1733},"order",{"type":61,"tag":1725,"props":1735,"children":1736},{},[1737],{"type":67,"value":1738},"Provider priority list; try first, failover to next",{"type":61,"tag":1703,"props":1740,"children":1741},{},[1742,1751],{"type":61,"tag":1725,"props":1743,"children":1744},{},[1745],{"type":61,"tag":141,"props":1746,"children":1748},{"className":1747},[],[1749],{"type":67,"value":1750},"only",{"type":61,"tag":1725,"props":1752,"children":1753},{},[1754],{"type":67,"value":1755},"Restrict to specific providers",{"type":61,"tag":1703,"props":1757,"children":1758},{},[1759,1768],{"type":61,"tag":1725,"props":1760,"children":1761},{},[1762],{"type":61,"tag":141,"props":1763,"children":1765},{"className":1764},[],[1766],{"type":67,"value":1767},"models",{"type":61,"tag":1725,"props":1769,"children":1770},{},[1771],{"type":67,"value":1772},"Fallback model list if primary model unavailable",{"type":61,"tag":1703,"props":1774,"children":1775},{},[1776,1785],{"type":61,"tag":1725,"props":1777,"children":1778},{},[1779],{"type":61,"tag":141,"props":1780,"children":1782},{"className":1781},[],[1783],{"type":67,"value":1784},"user",{"type":61,"tag":1725,"props":1786,"children":1787},{},[1788],{"type":67,"value":1789},"End-user ID for usage tracking",{"type":61,"tag":1703,"props":1791,"children":1792},{},[1793,1802],{"type":61,"tag":1725,"props":1794,"children":1795},{},[1796],{"type":61,"tag":141,"props":1797,"children":1799},{"className":1798},[],[1800],{"type":67,"value":1801},"tags",{"type":61,"tag":1725,"props":1803,"children":1804},{},[1805],{"type":67,"value":1806},"Labels for cost attribution and reporting",{"type":61,"tag":115,"props":1808,"children":1810},{"id":1809},"cache-control-headers",[1811],{"type":67,"value":1812},"Cache-Control Headers",{"type":61,"tag":74,"props":1814,"children":1815},{},[1816],{"type":67,"value":1817},"AI Gateway supports response caching to reduce latency and cost for repeated or similar requests:",{"type":61,"tag":195,"props":1819,"children":1821},{"className":197,"code":1820,"language":199,"meta":200,"style":200},"const result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  prompt: 'What is the capital of France?',\n  providerOptions: {\n    gateway: {\n      \u002F\u002F Cache identical requests for 1 hour\n      cacheControl: 'max-age=3600',\n    },\n  },\n})\n",[1822],{"type":61,"tag":141,"props":1823,"children":1824},{"__ignoreMap":200},[1825,1856,1895,1923,1938,1953,1961,1990,1997,2004],{"type":61,"tag":206,"props":1826,"children":1827},{"class":208,"line":209},[1828,1832,1836,1840,1844,1848,1852],{"type":61,"tag":206,"props":1829,"children":1830},{"style":270},[1831],{"type":67,"value":273},{"type":61,"tag":206,"props":1833,"children":1834},{"style":225},[1835],{"type":67,"value":278},{"type":61,"tag":206,"props":1837,"children":1838},{"style":219},[1839],{"type":67,"value":283},{"type":61,"tag":206,"props":1841,"children":1842},{"style":213},[1843],{"type":67,"value":288},{"type":61,"tag":206,"props":1845,"children":1846},{"style":291},[1847],{"type":67,"value":228},{"type":61,"tag":206,"props":1849,"children":1850},{"style":225},[1851],{"type":67,"value":298},{"type":61,"tag":206,"props":1853,"children":1854},{"style":219},[1855],{"type":67,"value":303},{"type":61,"tag":206,"props":1857,"children":1858},{"class":208,"line":256},[1859,1863,1867,1871,1875,1879,1883,1887,1891],{"type":61,"tag":206,"props":1860,"children":1861},{"style":310},[1862],{"type":67,"value":313},{"type":61,"tag":206,"props":1864,"children":1865},{"style":219},[1866],{"type":67,"value":318},{"type":61,"tag":206,"props":1868,"children":1869},{"style":291},[1870],{"type":67,"value":439},{"type":61,"tag":206,"props":1872,"children":1873},{"style":225},[1874],{"type":67,"value":298},{"type":61,"tag":206,"props":1876,"children":1877},{"style":219},[1878],{"type":67,"value":332},{"type":61,"tag":206,"props":1880,"children":1881},{"style":246},[1882],{"type":67,"value":327},{"type":61,"tag":206,"props":1884,"children":1885},{"style":219},[1886],{"type":67,"value":332},{"type":61,"tag":206,"props":1888,"children":1889},{"style":225},[1890],{"type":67,"value":533},{"type":61,"tag":206,"props":1892,"children":1893},{"style":219},[1894],{"type":67,"value":374},{"type":61,"tag":206,"props":1896,"children":1897},{"class":208,"line":266},[1898,1902,1906,1910,1915,1919],{"type":61,"tag":206,"props":1899,"children":1900},{"style":310},[1901],{"type":67,"value":352},{"type":61,"tag":206,"props":1903,"children":1904},{"style":219},[1905],{"type":67,"value":318},{"type":61,"tag":206,"props":1907,"children":1908},{"style":219},[1909],{"type":67,"value":243},{"type":61,"tag":206,"props":1911,"children":1912},{"style":246},[1913],{"type":67,"value":1914},"What is the capital of France?",{"type":61,"tag":206,"props":1916,"children":1917},{"style":219},[1918],{"type":67,"value":332},{"type":61,"tag":206,"props":1920,"children":1921},{"style":219},[1922],{"type":67,"value":374},{"type":61,"tag":206,"props":1924,"children":1925},{"class":208,"line":306},[1926,1930,1934],{"type":61,"tag":206,"props":1927,"children":1928},{"style":310},[1929],{"type":67,"value":545},{"type":61,"tag":206,"props":1931,"children":1932},{"style":219},[1933],{"type":67,"value":318},{"type":61,"tag":206,"props":1935,"children":1936},{"style":219},[1937],{"type":67,"value":1300},{"type":61,"tag":206,"props":1939,"children":1940},{"class":208,"line":346},[1941,1945,1949],{"type":61,"tag":206,"props":1942,"children":1943},{"style":310},[1944],{"type":67,"value":1308},{"type":61,"tag":206,"props":1946,"children":1947},{"style":219},[1948],{"type":67,"value":318},{"type":61,"tag":206,"props":1950,"children":1951},{"style":219},[1952],{"type":67,"value":1300},{"type":61,"tag":206,"props":1954,"children":1955},{"class":208,"line":377},[1956],{"type":61,"tag":206,"props":1957,"children":1958},{"style":340},[1959],{"type":67,"value":1960},"      \u002F\u002F Cache identical requests for 1 hour\n",{"type":61,"tag":206,"props":1962,"children":1963},{"class":208,"line":42},[1964,1969,1973,1977,1982,1986],{"type":61,"tag":206,"props":1965,"children":1966},{"style":310},[1967],{"type":67,"value":1968},"      cacheControl",{"type":61,"tag":206,"props":1970,"children":1971},{"style":219},[1972],{"type":67,"value":318},{"type":61,"tag":206,"props":1974,"children":1975},{"style":219},[1976],{"type":67,"value":243},{"type":61,"tag":206,"props":1978,"children":1979},{"style":246},[1980],{"type":67,"value":1981},"max-age=3600",{"type":61,"tag":206,"props":1983,"children":1984},{"style":219},[1985],{"type":67,"value":332},{"type":61,"tag":206,"props":1987,"children":1988},{"style":219},[1989],{"type":67,"value":374},{"type":61,"tag":206,"props":1991,"children":1992},{"class":208,"line":1382},[1993],{"type":61,"tag":206,"props":1994,"children":1995},{"style":219},[1996],{"type":67,"value":1666},{"type":61,"tag":206,"props":1998,"children":1999},{"class":208,"line":1390},[2000],{"type":61,"tag":206,"props":2001,"children":2002},{"style":219},[2003],{"type":67,"value":1675},{"type":61,"tag":206,"props":2005,"children":2006},{"class":208,"line":1399},[2007,2011],{"type":61,"tag":206,"props":2008,"children":2009},{"style":219},[2010],{"type":67,"value":383},{"type":61,"tag":206,"props":2012,"children":2013},{"style":225},[2014],{"type":67,"value":388},{"type":61,"tag":851,"props":2016,"children":2018},{"id":2017},"caching-strategies",[2019],{"type":67,"value":2020},"Caching strategies",{"type":61,"tag":1695,"props":2022,"children":2023},{},[2024,2040],{"type":61,"tag":1699,"props":2025,"children":2026},{},[2027],{"type":61,"tag":1703,"props":2028,"children":2029},{},[2030,2035],{"type":61,"tag":1707,"props":2031,"children":2032},{},[2033],{"type":67,"value":2034},"Header Value",{"type":61,"tag":1707,"props":2036,"children":2037},{},[2038],{"type":67,"value":2039},"Behavior",{"type":61,"tag":1718,"props":2041,"children":2042},{},[2043,2059,2076,2093],{"type":61,"tag":1703,"props":2044,"children":2045},{},[2046,2054],{"type":61,"tag":1725,"props":2047,"children":2048},{},[2049],{"type":61,"tag":141,"props":2050,"children":2052},{"className":2051},[],[2053],{"type":67,"value":1981},{"type":61,"tag":1725,"props":2055,"children":2056},{},[2057],{"type":67,"value":2058},"Cache response for 1 hour",{"type":61,"tag":1703,"props":2060,"children":2061},{},[2062,2071],{"type":61,"tag":1725,"props":2063,"children":2064},{},[2065],{"type":61,"tag":141,"props":2066,"children":2068},{"className":2067},[],[2069],{"type":67,"value":2070},"max-age=0",{"type":61,"tag":1725,"props":2072,"children":2073},{},[2074],{"type":67,"value":2075},"Bypass cache, always call provider",{"type":61,"tag":1703,"props":2077,"children":2078},{},[2079,2088],{"type":61,"tag":1725,"props":2080,"children":2081},{},[2082],{"type":61,"tag":141,"props":2083,"children":2085},{"className":2084},[],[2086],{"type":67,"value":2087},"s-maxage=86400",{"type":61,"tag":1725,"props":2089,"children":2090},{},[2091],{"type":67,"value":2092},"Cache at the edge for 24 hours",{"type":61,"tag":1703,"props":2094,"children":2095},{},[2096,2105],{"type":61,"tag":1725,"props":2097,"children":2098},{},[2099],{"type":61,"tag":141,"props":2100,"children":2102},{"className":2101},[],[2103],{"type":67,"value":2104},"stale-while-revalidate=600",{"type":61,"tag":1725,"props":2106,"children":2107},{},[2108],{"type":67,"value":2109},"Serve stale for 10 min while refreshing in background",{"type":61,"tag":851,"props":2111,"children":2113},{"id":2112},"when-to-use-caching",[2114],{"type":67,"value":2115},"When to use caching",{"type":61,"tag":133,"props":2117,"children":2118},{},[2119,2129,2139,2149],{"type":61,"tag":137,"props":2120,"children":2121},{},[2122,2127],{"type":61,"tag":78,"props":2123,"children":2124},{},[2125],{"type":67,"value":2126},"Static knowledge queries",{"type":67,"value":2128},": FAQs, translations, factual lookups — cache aggressively",{"type":61,"tag":137,"props":2130,"children":2131},{},[2132,2137],{"type":61,"tag":78,"props":2133,"children":2134},{},[2135],{"type":67,"value":2136},"User-specific conversations",{"type":67,"value":2138},": Do not cache — each response depends on conversation history",{"type":61,"tag":137,"props":2140,"children":2141},{},[2142,2147],{"type":61,"tag":78,"props":2143,"children":2144},{},[2145],{"type":67,"value":2146},"Embeddings",{"type":67,"value":2148},": Cache embedding results for identical inputs to save cost",{"type":61,"tag":137,"props":2150,"children":2151},{},[2152,2157],{"type":61,"tag":78,"props":2153,"children":2154},{},[2155],{"type":67,"value":2156},"Structured extraction",{"type":67,"value":2158},": Cache when extracting structured data from identical documents",{"type":61,"tag":851,"props":2160,"children":2162},{"id":2161},"cache-key-composition",[2163],{"type":67,"value":2164},"Cache key composition",{"type":61,"tag":74,"props":2166,"children":2167},{},[2168],{"type":67,"value":2169},"The cache key is derived from: model, prompt\u002Fmessages, temperature, and other generation parameters. Changing any parameter produces a new cache key.",{"type":61,"tag":115,"props":2171,"children":2173},{"id":2172},"per-user-rate-limiting",[2174],{"type":67,"value":2175},"Per-User Rate Limiting",{"type":61,"tag":74,"props":2177,"children":2178},{},[2179],{"type":67,"value":2180},"Control usage at the individual user level to prevent abuse and manage costs:",{"type":61,"tag":195,"props":2182,"children":2184},{"className":197,"code":2183,"language":199,"meta":200,"style":200},"const result = await generateText({\n  model: gateway('openai\u002Fgpt-5.4'),\n  prompt: userMessage,\n  providerOptions: {\n    gateway: {\n      user: userId, \u002F\u002F Required for per-user rate limiting\n      tags: ['feature:chat'],\n    },\n  },\n})\n",[2185],{"type":61,"tag":141,"props":2186,"children":2187},{"__ignoreMap":200},[2188,2219,2258,2278,2293,2308,2333,2368,2375,2382],{"type":61,"tag":206,"props":2189,"children":2190},{"class":208,"line":209},[2191,2195,2199,2203,2207,2211,2215],{"type":61,"tag":206,"props":2192,"children":2193},{"style":270},[2194],{"type":67,"value":273},{"type":61,"tag":206,"props":2196,"children":2197},{"style":225},[2198],{"type":67,"value":278},{"type":61,"tag":206,"props":2200,"children":2201},{"style":219},[2202],{"type":67,"value":283},{"type":61,"tag":206,"props":2204,"children":2205},{"style":213},[2206],{"type":67,"value":288},{"type":61,"tag":206,"props":2208,"children":2209},{"style":291},[2210],{"type":67,"value":228},{"type":61,"tag":206,"props":2212,"children":2213},{"style":225},[2214],{"type":67,"value":298},{"type":61,"tag":206,"props":2216,"children":2217},{"style":219},[2218],{"type":67,"value":303},{"type":61,"tag":206,"props":2220,"children":2221},{"class":208,"line":256},[2222,2226,2230,2234,2238,2242,2246,2250,2254],{"type":61,"tag":206,"props":2223,"children":2224},{"style":310},[2225],{"type":67,"value":313},{"type":61,"tag":206,"props":2227,"children":2228},{"style":219},[2229],{"type":67,"value":318},{"type":61,"tag":206,"props":2231,"children":2232},{"style":291},[2233],{"type":67,"value":439},{"type":61,"tag":206,"props":2235,"children":2236},{"style":225},[2237],{"type":67,"value":298},{"type":61,"tag":206,"props":2239,"children":2240},{"style":219},[2241],{"type":67,"value":332},{"type":61,"tag":206,"props":2243,"children":2244},{"style":246},[2245],{"type":67,"value":327},{"type":61,"tag":206,"props":2247,"children":2248},{"style":219},[2249],{"type":67,"value":332},{"type":61,"tag":206,"props":2251,"children":2252},{"style":225},[2253],{"type":67,"value":533},{"type":61,"tag":206,"props":2255,"children":2256},{"style":219},[2257],{"type":67,"value":374},{"type":61,"tag":206,"props":2259,"children":2260},{"class":208,"line":266},[2261,2265,2269,2274],{"type":61,"tag":206,"props":2262,"children":2263},{"style":310},[2264],{"type":67,"value":352},{"type":61,"tag":206,"props":2266,"children":2267},{"style":219},[2268],{"type":67,"value":318},{"type":61,"tag":206,"props":2270,"children":2271},{"style":225},[2272],{"type":67,"value":2273}," userMessage",{"type":61,"tag":206,"props":2275,"children":2276},{"style":219},[2277],{"type":67,"value":374},{"type":61,"tag":206,"props":2279,"children":2280},{"class":208,"line":306},[2281,2285,2289],{"type":61,"tag":206,"props":2282,"children":2283},{"style":310},[2284],{"type":67,"value":545},{"type":61,"tag":206,"props":2286,"children":2287},{"style":219},[2288],{"type":67,"value":318},{"type":61,"tag":206,"props":2290,"children":2291},{"style":219},[2292],{"type":67,"value":1300},{"type":61,"tag":206,"props":2294,"children":2295},{"class":208,"line":346},[2296,2300,2304],{"type":61,"tag":206,"props":2297,"children":2298},{"style":310},[2299],{"type":67,"value":1308},{"type":61,"tag":206,"props":2301,"children":2302},{"style":219},[2303],{"type":67,"value":318},{"type":61,"tag":206,"props":2305,"children":2306},{"style":219},[2307],{"type":67,"value":1300},{"type":61,"tag":206,"props":2309,"children":2310},{"class":208,"line":377},[2311,2315,2319,2324,2328],{"type":61,"tag":206,"props":2312,"children":2313},{"style":310},[2314],{"type":67,"value":1547},{"type":61,"tag":206,"props":2316,"children":2317},{"style":219},[2318],{"type":67,"value":318},{"type":61,"tag":206,"props":2320,"children":2321},{"style":225},[2322],{"type":67,"value":2323}," userId",{"type":61,"tag":206,"props":2325,"children":2326},{"style":219},[2327],{"type":67,"value":337},{"type":61,"tag":206,"props":2329,"children":2330},{"style":340},[2331],{"type":67,"value":2332}," \u002F\u002F Required for per-user rate limiting\n",{"type":61,"tag":206,"props":2334,"children":2335},{"class":208,"line":42},[2336,2340,2344,2348,2352,2356,2360,2364],{"type":61,"tag":206,"props":2337,"children":2338},{"style":310},[2339],{"type":67,"value":1594},{"type":61,"tag":206,"props":2341,"children":2342},{"style":219},[2343],{"type":67,"value":318},{"type":61,"tag":206,"props":2345,"children":2346},{"style":225},[2347],{"type":67,"value":579},{"type":61,"tag":206,"props":2349,"children":2350},{"style":219},[2351],{"type":67,"value":332},{"type":61,"tag":206,"props":2353,"children":2354},{"style":246},[2355],{"type":67,"value":1611},{"type":61,"tag":206,"props":2357,"children":2358},{"style":219},[2359],{"type":67,"value":332},{"type":61,"tag":206,"props":2361,"children":2362},{"style":225},[2363],{"type":67,"value":1375},{"type":61,"tag":206,"props":2365,"children":2366},{"style":219},[2367],{"type":67,"value":374},{"type":61,"tag":206,"props":2369,"children":2370},{"class":208,"line":1382},[2371],{"type":61,"tag":206,"props":2372,"children":2373},{"style":219},[2374],{"type":67,"value":1666},{"type":61,"tag":206,"props":2376,"children":2377},{"class":208,"line":1390},[2378],{"type":61,"tag":206,"props":2379,"children":2380},{"style":219},[2381],{"type":67,"value":1675},{"type":61,"tag":206,"props":2383,"children":2384},{"class":208,"line":1399},[2385,2389],{"type":61,"tag":206,"props":2386,"children":2387},{"style":219},[2388],{"type":67,"value":383},{"type":61,"tag":206,"props":2390,"children":2391},{"style":225},[2392],{"type":67,"value":388},{"type":61,"tag":851,"props":2394,"children":2396},{"id":2395},"rate-limit-configuration",[2397],{"type":67,"value":2398},"Rate limit configuration",{"type":61,"tag":74,"props":2400,"children":2401},{},[2402,2404,2410,2412,2417,2418,2423],{"type":67,"value":2403},"Configure rate limits at ",{"type":61,"tag":141,"props":2405,"children":2407},{"className":2406},[],[2408],{"type":67,"value":2409},"https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fsettings",{"type":67,"value":2411}," → ",{"type":61,"tag":78,"props":2413,"children":2414},{},[2415],{"type":67,"value":2416},"AI Gateway",{"type":67,"value":2411},{"type":61,"tag":78,"props":2419,"children":2420},{},[2421],{"type":67,"value":2422},"Rate Limits",{"type":67,"value":318},{"type":61,"tag":133,"props":2425,"children":2426},{},[2427,2437,2447],{"type":61,"tag":137,"props":2428,"children":2429},{},[2430,2435],{"type":61,"tag":78,"props":2431,"children":2432},{},[2433],{"type":67,"value":2434},"Requests per minute per user",{"type":67,"value":2436},": Throttle individual users (e.g., 20 RPM)",{"type":61,"tag":137,"props":2438,"children":2439},{},[2440,2445],{"type":61,"tag":78,"props":2441,"children":2442},{},[2443],{"type":67,"value":2444},"Tokens per day per user",{"type":67,"value":2446},": Cap daily token consumption (e.g., 100K tokens\u002Fday)",{"type":61,"tag":137,"props":2448,"children":2449},{},[2450,2455],{"type":61,"tag":78,"props":2451,"children":2452},{},[2453],{"type":67,"value":2454},"Concurrent requests per user",{"type":67,"value":2456},": Limit parallel calls (e.g., 3 concurrent)",{"type":61,"tag":851,"props":2458,"children":2460},{"id":2459},"handling-rate-limit-responses",[2461],{"type":67,"value":2462},"Handling rate limit responses",{"type":61,"tag":74,"props":2464,"children":2465},{},[2466],{"type":67,"value":2467},"When a user exceeds their limit, the gateway returns HTTP 429:",{"type":61,"tag":195,"props":2469,"children":2471},{"className":197,"code":2470,"language":199,"meta":200,"style":200},"import { generateText, APICallError } from 'ai'\n\ntry {\n  const result = await generateText({\n    model: gateway('openai\u002Fgpt-5.4'),\n    prompt: userMessage,\n    providerOptions: { gateway: { user: userId } },\n  })\n} catch (error) {\n  if (APICallError.isInstance(error) && error.statusCode === 429) {\n    const retryAfter = error.responseHeaders?.['retry-after']\n    return new Response(\n      JSON.stringify({ error: 'Rate limited', retryAfter }),\n      { status: 429 }\n    )\n  }\n  throw error\n}\n",[2472],{"type":61,"tag":141,"props":2473,"children":2474},{"__ignoreMap":200},[2475,2519,2526,2538,2572,2612,2632,2681,2693,2714,2792,2850,2873,2940,2966,2974,2982,2995],{"type":61,"tag":206,"props":2476,"children":2477},{"class":208,"line":209},[2478,2482,2486,2490,2494,2499,2503,2507,2511,2515],{"type":61,"tag":206,"props":2479,"children":2480},{"style":213},[2481],{"type":67,"value":216},{"type":61,"tag":206,"props":2483,"children":2484},{"style":219},[2485],{"type":67,"value":222},{"type":61,"tag":206,"props":2487,"children":2488},{"style":225},[2489],{"type":67,"value":228},{"type":61,"tag":206,"props":2491,"children":2492},{"style":219},[2493],{"type":67,"value":337},{"type":61,"tag":206,"props":2495,"children":2496},{"style":225},[2497],{"type":67,"value":2498}," APICallError",{"type":61,"tag":206,"props":2500,"children":2501},{"style":219},[2502],{"type":67,"value":233},{"type":61,"tag":206,"props":2504,"children":2505},{"style":213},[2506],{"type":67,"value":238},{"type":61,"tag":206,"props":2508,"children":2509},{"style":219},[2510],{"type":67,"value":243},{"type":61,"tag":206,"props":2512,"children":2513},{"style":246},[2514],{"type":67,"value":49},{"type":61,"tag":206,"props":2516,"children":2517},{"style":219},[2518],{"type":67,"value":253},{"type":61,"tag":206,"props":2520,"children":2521},{"class":208,"line":256},[2522],{"type":61,"tag":206,"props":2523,"children":2524},{"emptyLinePlaceholder":260},[2525],{"type":67,"value":263},{"type":61,"tag":206,"props":2527,"children":2528},{"class":208,"line":266},[2529,2534],{"type":61,"tag":206,"props":2530,"children":2531},{"style":213},[2532],{"type":67,"value":2533},"try",{"type":61,"tag":206,"props":2535,"children":2536},{"style":219},[2537],{"type":67,"value":1300},{"type":61,"tag":206,"props":2539,"children":2540},{"class":208,"line":306},[2541,2546,2551,2556,2560,2564,2568],{"type":61,"tag":206,"props":2542,"children":2543},{"style":270},[2544],{"type":67,"value":2545},"  const",{"type":61,"tag":206,"props":2547,"children":2548},{"style":225},[2549],{"type":67,"value":2550}," result",{"type":61,"tag":206,"props":2552,"children":2553},{"style":219},[2554],{"type":67,"value":2555}," =",{"type":61,"tag":206,"props":2557,"children":2558},{"style":213},[2559],{"type":67,"value":288},{"type":61,"tag":206,"props":2561,"children":2562},{"style":291},[2563],{"type":67,"value":228},{"type":61,"tag":206,"props":2565,"children":2566},{"style":310},[2567],{"type":67,"value":298},{"type":61,"tag":206,"props":2569,"children":2570},{"style":219},[2571],{"type":67,"value":303},{"type":61,"tag":206,"props":2573,"children":2574},{"class":208,"line":346},[2575,2580,2584,2588,2592,2596,2600,2604,2608],{"type":61,"tag":206,"props":2576,"children":2577},{"style":310},[2578],{"type":67,"value":2579},"    model",{"type":61,"tag":206,"props":2581,"children":2582},{"style":219},[2583],{"type":67,"value":318},{"type":61,"tag":206,"props":2585,"children":2586},{"style":291},[2587],{"type":67,"value":439},{"type":61,"tag":206,"props":2589,"children":2590},{"style":310},[2591],{"type":67,"value":298},{"type":61,"tag":206,"props":2593,"children":2594},{"style":219},[2595],{"type":67,"value":332},{"type":61,"tag":206,"props":2597,"children":2598},{"style":246},[2599],{"type":67,"value":327},{"type":61,"tag":206,"props":2601,"children":2602},{"style":219},[2603],{"type":67,"value":332},{"type":61,"tag":206,"props":2605,"children":2606},{"style":310},[2607],{"type":67,"value":533},{"type":61,"tag":206,"props":2609,"children":2610},{"style":219},[2611],{"type":67,"value":374},{"type":61,"tag":206,"props":2613,"children":2614},{"class":208,"line":377},[2615,2620,2624,2628],{"type":61,"tag":206,"props":2616,"children":2617},{"style":310},[2618],{"type":67,"value":2619},"    prompt",{"type":61,"tag":206,"props":2621,"children":2622},{"style":219},[2623],{"type":67,"value":318},{"type":61,"tag":206,"props":2625,"children":2626},{"style":225},[2627],{"type":67,"value":2273},{"type":61,"tag":206,"props":2629,"children":2630},{"style":219},[2631],{"type":67,"value":374},{"type":61,"tag":206,"props":2633,"children":2634},{"class":208,"line":42},[2635,2640,2644,2648,2652,2656,2660,2665,2669,2673,2677],{"type":61,"tag":206,"props":2636,"children":2637},{"style":310},[2638],{"type":67,"value":2639},"    providerOptions",{"type":61,"tag":206,"props":2641,"children":2642},{"style":219},[2643],{"type":67,"value":318},{"type":61,"tag":206,"props":2645,"children":2646},{"style":219},[2647],{"type":67,"value":222},{"type":61,"tag":206,"props":2649,"children":2650},{"style":310},[2651],{"type":67,"value":439},{"type":61,"tag":206,"props":2653,"children":2654},{"style":219},[2655],{"type":67,"value":318},{"type":61,"tag":206,"props":2657,"children":2658},{"style":219},[2659],{"type":67,"value":222},{"type":61,"tag":206,"props":2661,"children":2662},{"style":310},[2663],{"type":67,"value":2664}," user",{"type":61,"tag":206,"props":2666,"children":2667},{"style":219},[2668],{"type":67,"value":318},{"type":61,"tag":206,"props":2670,"children":2671},{"style":225},[2672],{"type":67,"value":2323},{"type":61,"tag":206,"props":2674,"children":2675},{"style":219},[2676],{"type":67,"value":233},{"type":61,"tag":206,"props":2678,"children":2679},{"style":219},[2680],{"type":67,"value":622},{"type":61,"tag":206,"props":2682,"children":2683},{"class":208,"line":1382},[2684,2689],{"type":61,"tag":206,"props":2685,"children":2686},{"style":219},[2687],{"type":67,"value":2688},"  }",{"type":61,"tag":206,"props":2690,"children":2691},{"style":310},[2692],{"type":67,"value":388},{"type":61,"tag":206,"props":2694,"children":2695},{"class":208,"line":1390},[2696,2700,2705,2710],{"type":61,"tag":206,"props":2697,"children":2698},{"style":219},[2699],{"type":67,"value":383},{"type":61,"tag":206,"props":2701,"children":2702},{"style":213},[2703],{"type":67,"value":2704}," catch",{"type":61,"tag":206,"props":2706,"children":2707},{"style":225},[2708],{"type":67,"value":2709}," (error) ",{"type":61,"tag":206,"props":2711,"children":2712},{"style":219},[2713],{"type":67,"value":303},{"type":61,"tag":206,"props":2715,"children":2716},{"class":208,"line":1399},[2717,2722,2726,2731,2735,2740,2744,2749,2754,2759,2764,2768,2773,2778,2784,2788],{"type":61,"tag":206,"props":2718,"children":2719},{"style":213},[2720],{"type":67,"value":2721},"  if",{"type":61,"tag":206,"props":2723,"children":2724},{"style":310},[2725],{"type":67,"value":974},{"type":61,"tag":206,"props":2727,"children":2728},{"style":225},[2729],{"type":67,"value":2730},"APICallError",{"type":61,"tag":206,"props":2732,"children":2733},{"style":219},[2734],{"type":67,"value":724},{"type":61,"tag":206,"props":2736,"children":2737},{"style":291},[2738],{"type":67,"value":2739},"isInstance",{"type":61,"tag":206,"props":2741,"children":2742},{"style":310},[2743],{"type":67,"value":298},{"type":61,"tag":206,"props":2745,"children":2746},{"style":225},[2747],{"type":67,"value":2748},"error",{"type":61,"tag":206,"props":2750,"children":2751},{"style":310},[2752],{"type":67,"value":2753},") ",{"type":61,"tag":206,"props":2755,"children":2756},{"style":219},[2757],{"type":67,"value":2758},"&&",{"type":61,"tag":206,"props":2760,"children":2761},{"style":225},[2762],{"type":67,"value":2763}," error",{"type":61,"tag":206,"props":2765,"children":2766},{"style":219},[2767],{"type":67,"value":724},{"type":61,"tag":206,"props":2769,"children":2770},{"style":225},[2771],{"type":67,"value":2772},"statusCode",{"type":61,"tag":206,"props":2774,"children":2775},{"style":219},[2776],{"type":67,"value":2777}," ===",{"type":61,"tag":206,"props":2779,"children":2781},{"style":2780},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[2782],{"type":67,"value":2783}," 429",{"type":61,"tag":206,"props":2785,"children":2786},{"style":310},[2787],{"type":67,"value":2753},{"type":61,"tag":206,"props":2789,"children":2790},{"style":219},[2791],{"type":67,"value":303},{"type":61,"tag":206,"props":2793,"children":2794},{"class":208,"line":1453},[2795,2800,2805,2809,2813,2817,2822,2827,2832,2836,2841,2845],{"type":61,"tag":206,"props":2796,"children":2797},{"style":270},[2798],{"type":67,"value":2799},"    const",{"type":61,"tag":206,"props":2801,"children":2802},{"style":225},[2803],{"type":67,"value":2804}," retryAfter",{"type":61,"tag":206,"props":2806,"children":2807},{"style":219},[2808],{"type":67,"value":2555},{"type":61,"tag":206,"props":2810,"children":2811},{"style":225},[2812],{"type":67,"value":2763},{"type":61,"tag":206,"props":2814,"children":2815},{"style":219},[2816],{"type":67,"value":724},{"type":61,"tag":206,"props":2818,"children":2819},{"style":225},[2820],{"type":67,"value":2821},"responseHeaders",{"type":61,"tag":206,"props":2823,"children":2824},{"style":219},[2825],{"type":67,"value":2826},"?.",{"type":61,"tag":206,"props":2828,"children":2829},{"style":310},[2830],{"type":67,"value":2831},"[",{"type":61,"tag":206,"props":2833,"children":2834},{"style":219},[2835],{"type":67,"value":332},{"type":61,"tag":206,"props":2837,"children":2838},{"style":246},[2839],{"type":67,"value":2840},"retry-after",{"type":61,"tag":206,"props":2842,"children":2843},{"style":219},[2844],{"type":67,"value":332},{"type":61,"tag":206,"props":2846,"children":2847},{"style":310},[2848],{"type":67,"value":2849},"]\n",{"type":61,"tag":206,"props":2851,"children":2852},{"class":208,"line":1461},[2853,2858,2863,2868],{"type":61,"tag":206,"props":2854,"children":2855},{"style":213},[2856],{"type":67,"value":2857},"    return",{"type":61,"tag":206,"props":2859,"children":2860},{"style":219},[2861],{"type":67,"value":2862}," new",{"type":61,"tag":206,"props":2864,"children":2865},{"style":291},[2866],{"type":67,"value":2867}," Response",{"type":61,"tag":206,"props":2869,"children":2870},{"style":310},[2871],{"type":67,"value":2872},"(\n",{"type":61,"tag":206,"props":2874,"children":2875},{"class":208,"line":1470},[2876,2881,2885,2890,2894,2899,2903,2907,2911,2916,2920,2924,2928,2932,2936],{"type":61,"tag":206,"props":2877,"children":2878},{"style":225},[2879],{"type":67,"value":2880},"      JSON",{"type":61,"tag":206,"props":2882,"children":2883},{"style":219},[2884],{"type":67,"value":724},{"type":61,"tag":206,"props":2886,"children":2887},{"style":291},[2888],{"type":67,"value":2889},"stringify",{"type":61,"tag":206,"props":2891,"children":2892},{"style":310},[2893],{"type":67,"value":298},{"type":61,"tag":206,"props":2895,"children":2896},{"style":219},[2897],{"type":67,"value":2898},"{",{"type":61,"tag":206,"props":2900,"children":2901},{"style":310},[2902],{"type":67,"value":2763},{"type":61,"tag":206,"props":2904,"children":2905},{"style":219},[2906],{"type":67,"value":318},{"type":61,"tag":206,"props":2908,"children":2909},{"style":219},[2910],{"type":67,"value":243},{"type":61,"tag":206,"props":2912,"children":2913},{"style":246},[2914],{"type":67,"value":2915},"Rate limited",{"type":61,"tag":206,"props":2917,"children":2918},{"style":219},[2919],{"type":67,"value":332},{"type":61,"tag":206,"props":2921,"children":2922},{"style":219},[2923],{"type":67,"value":337},{"type":61,"tag":206,"props":2925,"children":2926},{"style":225},[2927],{"type":67,"value":2804},{"type":61,"tag":206,"props":2929,"children":2930},{"style":219},[2931],{"type":67,"value":233},{"type":61,"tag":206,"props":2933,"children":2934},{"style":310},[2935],{"type":67,"value":533},{"type":61,"tag":206,"props":2937,"children":2938},{"style":219},[2939],{"type":67,"value":374},{"type":61,"tag":206,"props":2941,"children":2942},{"class":208,"line":1524},[2943,2948,2953,2957,2961],{"type":61,"tag":206,"props":2944,"children":2945},{"style":219},[2946],{"type":67,"value":2947},"      {",{"type":61,"tag":206,"props":2949,"children":2950},{"style":310},[2951],{"type":67,"value":2952}," status",{"type":61,"tag":206,"props":2954,"children":2955},{"style":219},[2956],{"type":67,"value":318},{"type":61,"tag":206,"props":2958,"children":2959},{"style":2780},[2960],{"type":67,"value":2783},{"type":61,"tag":206,"props":2962,"children":2963},{"style":219},[2964],{"type":67,"value":2965}," }\n",{"type":61,"tag":206,"props":2967,"children":2968},{"class":208,"line":1532},[2969],{"type":61,"tag":206,"props":2970,"children":2971},{"style":310},[2972],{"type":67,"value":2973},"    )\n",{"type":61,"tag":206,"props":2975,"children":2976},{"class":208,"line":1541},[2977],{"type":61,"tag":206,"props":2978,"children":2979},{"style":219},[2980],{"type":67,"value":2981},"  }\n",{"type":61,"tag":206,"props":2983,"children":2984},{"class":208,"line":1571},[2985,2990],{"type":61,"tag":206,"props":2986,"children":2987},{"style":213},[2988],{"type":67,"value":2989},"  throw",{"type":61,"tag":206,"props":2991,"children":2992},{"style":225},[2993],{"type":67,"value":2994}," error\n",{"type":61,"tag":206,"props":2996,"children":2997},{"class":208,"line":1579},[2998],{"type":61,"tag":206,"props":2999,"children":3000},{"style":219},[3001],{"type":67,"value":3002},"}\n",{"type":61,"tag":115,"props":3004,"children":3006},{"id":3005},"budget-alerts-and-cost-controls",[3007],{"type":67,"value":3008},"Budget Alerts and Cost Controls",{"type":61,"tag":851,"props":3010,"children":3012},{"id":3011},"tagging-for-cost-attribution",[3013],{"type":67,"value":3014},"Tagging for cost attribution",{"type":61,"tag":74,"props":3016,"children":3017},{},[3018],{"type":67,"value":3019},"Use tags to track spend by feature, team, and environment:",{"type":61,"tag":195,"props":3021,"children":3023},{"className":197,"code":3022,"language":199,"meta":200,"style":200},"providerOptions: {\n  gateway: {\n    tags: [\n      'feature:document-qa',\n      'team:product',\n      'env:production',\n      'tier:premium',\n    ],\n    user: userId,\n  },\n}\n",[3024],{"type":61,"tag":141,"props":3025,"children":3026},{"__ignoreMap":200},[3027,3043,3059,3076,3097,3117,3136,3156,3168,3188,3195],{"type":61,"tag":206,"props":3028,"children":3029},{"class":208,"line":209},[3030,3035,3039],{"type":61,"tag":206,"props":3031,"children":3032},{"style":870},[3033],{"type":67,"value":3034},"providerOptions",{"type":61,"tag":206,"props":3036,"children":3037},{"style":219},[3038],{"type":67,"value":318},{"type":61,"tag":206,"props":3040,"children":3041},{"style":219},[3042],{"type":67,"value":1300},{"type":61,"tag":206,"props":3044,"children":3045},{"class":208,"line":256},[3046,3051,3055],{"type":61,"tag":206,"props":3047,"children":3048},{"style":870},[3049],{"type":67,"value":3050},"  gateway",{"type":61,"tag":206,"props":3052,"children":3053},{"style":219},[3054],{"type":67,"value":318},{"type":61,"tag":206,"props":3056,"children":3057},{"style":219},[3058],{"type":67,"value":1300},{"type":61,"tag":206,"props":3060,"children":3061},{"class":208,"line":266},[3062,3067,3071],{"type":61,"tag":206,"props":3063,"children":3064},{"style":870},[3065],{"type":67,"value":3066},"    tags",{"type":61,"tag":206,"props":3068,"children":3069},{"style":219},[3070],{"type":67,"value":318},{"type":61,"tag":206,"props":3072,"children":3073},{"style":310},[3074],{"type":67,"value":3075}," [\n",{"type":61,"tag":206,"props":3077,"children":3078},{"class":208,"line":306},[3079,3084,3089,3093],{"type":61,"tag":206,"props":3080,"children":3081},{"style":219},[3082],{"type":67,"value":3083},"      '",{"type":61,"tag":206,"props":3085,"children":3086},{"style":246},[3087],{"type":67,"value":3088},"feature:document-qa",{"type":61,"tag":206,"props":3090,"children":3091},{"style":219},[3092],{"type":67,"value":332},{"type":61,"tag":206,"props":3094,"children":3095},{"style":219},[3096],{"type":67,"value":374},{"type":61,"tag":206,"props":3098,"children":3099},{"class":208,"line":346},[3100,3104,3109,3113],{"type":61,"tag":206,"props":3101,"children":3102},{"style":219},[3103],{"type":67,"value":3083},{"type":61,"tag":206,"props":3105,"children":3106},{"style":246},[3107],{"type":67,"value":3108},"team:product",{"type":61,"tag":206,"props":3110,"children":3111},{"style":219},[3112],{"type":67,"value":332},{"type":61,"tag":206,"props":3114,"children":3115},{"style":219},[3116],{"type":67,"value":374},{"type":61,"tag":206,"props":3118,"children":3119},{"class":208,"line":377},[3120,3124,3128,3132],{"type":61,"tag":206,"props":3121,"children":3122},{"style":219},[3123],{"type":67,"value":3083},{"type":61,"tag":206,"props":3125,"children":3126},{"style":246},[3127],{"type":67,"value":1628},{"type":61,"tag":206,"props":3129,"children":3130},{"style":219},[3131],{"type":67,"value":332},{"type":61,"tag":206,"props":3133,"children":3134},{"style":219},[3135],{"type":67,"value":374},{"type":61,"tag":206,"props":3137,"children":3138},{"class":208,"line":42},[3139,3143,3148,3152],{"type":61,"tag":206,"props":3140,"children":3141},{"style":219},[3142],{"type":67,"value":3083},{"type":61,"tag":206,"props":3144,"children":3145},{"style":246},[3146],{"type":67,"value":3147},"tier:premium",{"type":61,"tag":206,"props":3149,"children":3150},{"style":219},[3151],{"type":67,"value":332},{"type":61,"tag":206,"props":3153,"children":3154},{"style":219},[3155],{"type":67,"value":374},{"type":61,"tag":206,"props":3157,"children":3158},{"class":208,"line":1382},[3159,3164],{"type":61,"tag":206,"props":3160,"children":3161},{"style":310},[3162],{"type":67,"value":3163},"    ]",{"type":61,"tag":206,"props":3165,"children":3166},{"style":219},[3167],{"type":67,"value":374},{"type":61,"tag":206,"props":3169,"children":3170},{"class":208,"line":1390},[3171,3176,3180,3184],{"type":61,"tag":206,"props":3172,"children":3173},{"style":870},[3174],{"type":67,"value":3175},"    user",{"type":61,"tag":206,"props":3177,"children":3178},{"style":219},[3179],{"type":67,"value":318},{"type":61,"tag":206,"props":3181,"children":3182},{"style":225},[3183],{"type":67,"value":2323},{"type":61,"tag":206,"props":3185,"children":3186},{"style":219},[3187],{"type":67,"value":374},{"type":61,"tag":206,"props":3189,"children":3190},{"class":208,"line":1399},[3191],{"type":61,"tag":206,"props":3192,"children":3193},{"style":219},[3194],{"type":67,"value":1675},{"type":61,"tag":206,"props":3196,"children":3197},{"class":208,"line":1453},[3198],{"type":61,"tag":206,"props":3199,"children":3200},{"style":219},[3201],{"type":67,"value":3002},{"type":61,"tag":851,"props":3203,"children":3205},{"id":3204},"setting-up-budget-alerts",[3206],{"type":67,"value":3207},"Setting up budget alerts",{"type":61,"tag":74,"props":3209,"children":3210},{},[3211,3213,3218,3219,3223],{"type":67,"value":3212},"In the Vercel dashboard at ",{"type":61,"tag":141,"props":3214,"children":3216},{"className":3215},[],[3217],{"type":67,"value":2409},{"type":67,"value":2411},{"type":61,"tag":78,"props":3220,"children":3221},{},[3222],{"type":67,"value":2416},{"type":67,"value":318},{"type":61,"tag":925,"props":3225,"children":3226},{},[3227,3237,3242,3247],{"type":61,"tag":137,"props":3228,"children":3229},{},[3230,3232],{"type":67,"value":3231},"Navigate to ",{"type":61,"tag":78,"props":3233,"children":3234},{},[3235],{"type":67,"value":3236},"AI Gateway → Usage & Budgets",{"type":61,"tag":137,"props":3238,"children":3239},{},[3240],{"type":67,"value":3241},"Set monthly budget thresholds (e.g., $500\u002Fmonth warning, $1000\u002Fmonth hard limit)",{"type":61,"tag":137,"props":3243,"children":3244},{},[3245],{"type":67,"value":3246},"Configure alert channels (email, Slack webhook, Vercel integration)",{"type":61,"tag":137,"props":3248,"children":3249},{},[3250],{"type":67,"value":3251},"Optionally set per-tag budgets for granular control",{"type":61,"tag":851,"props":3253,"children":3255},{"id":3254},"budget-isolation-best-practice",[3256],{"type":67,"value":3257},"Budget isolation best practice",{"type":61,"tag":74,"props":3259,"children":3260},{},[3261,3263,3268],{"type":67,"value":3262},"Use ",{"type":61,"tag":78,"props":3264,"children":3265},{},[3266],{"type":67,"value":3267},"separate gateway keys per environment",{"type":67,"value":3269}," (dev, staging, prod) and per project. This keeps dashboards clean and budgets isolated:",{"type":61,"tag":133,"props":3271,"children":3272},{},[3273,3278,3283],{"type":61,"tag":137,"props":3274,"children":3275},{},[3276],{"type":67,"value":3277},"Restrict AI Gateway keys per project to prevent cross-tenant leakage",{"type":61,"tag":137,"props":3279,"children":3280},{},[3281],{"type":67,"value":3282},"Use per-project budgets and spend-by-agent reporting to track exactly where tokens go",{"type":61,"tag":137,"props":3284,"children":3285},{},[3286],{"type":67,"value":3287},"Cap spend during staging with AI Gateway budgets",{"type":61,"tag":851,"props":3289,"children":3291},{"id":3290},"pre-flight-cost-controls",[3292],{"type":67,"value":3293},"Pre-flight cost controls",{"type":61,"tag":74,"props":3295,"children":3296},{},[3297],{"type":67,"value":3298},"The AI Gateway dashboard provides observability (traces, token counts, spend tracking) but no programmatic metrics API. Build your own cost guardrails by estimating token counts and rejecting expensive requests before they execute:",{"type":61,"tag":195,"props":3300,"children":3302},{"className":197,"code":3301,"language":199,"meta":200,"style":200},"import { generateText } from 'ai'\n\nfunction estimateTokens(text: string): number {\n  return Math.ceil(text.length \u002F 4) \u002F\u002F rough estimate\n}\n\nasync function callWithBudget(prompt: string, maxTokens: number) {\n  const estimated = estimateTokens(prompt)\n  if (estimated > maxTokens) {\n    throw new Error(`Prompt too large: ~${estimated} tokens exceeds ${maxTokens} limit`)\n  }\n  return generateText({ model: 'openai\u002Fgpt-5.4', prompt })\n}\n",[3303],{"type":61,"tag":141,"props":3304,"children":3305},{"__ignoreMap":200},[3306,3341,3348,3393,3451,3458,3465,3525,3557,3590,3665,3672,3729],{"type":61,"tag":206,"props":3307,"children":3308},{"class":208,"line":209},[3309,3313,3317,3321,3325,3329,3333,3337],{"type":61,"tag":206,"props":3310,"children":3311},{"style":213},[3312],{"type":67,"value":216},{"type":61,"tag":206,"props":3314,"children":3315},{"style":219},[3316],{"type":67,"value":222},{"type":61,"tag":206,"props":3318,"children":3319},{"style":225},[3320],{"type":67,"value":228},{"type":61,"tag":206,"props":3322,"children":3323},{"style":219},[3324],{"type":67,"value":233},{"type":61,"tag":206,"props":3326,"children":3327},{"style":213},[3328],{"type":67,"value":238},{"type":61,"tag":206,"props":3330,"children":3331},{"style":219},[3332],{"type":67,"value":243},{"type":61,"tag":206,"props":3334,"children":3335},{"style":246},[3336],{"type":67,"value":49},{"type":61,"tag":206,"props":3338,"children":3339},{"style":219},[3340],{"type":67,"value":253},{"type":61,"tag":206,"props":3342,"children":3343},{"class":208,"line":256},[3344],{"type":61,"tag":206,"props":3345,"children":3346},{"emptyLinePlaceholder":260},[3347],{"type":67,"value":263},{"type":61,"tag":206,"props":3349,"children":3350},{"class":208,"line":266},[3351,3356,3361,3365,3370,3374,3379,3384,3389],{"type":61,"tag":206,"props":3352,"children":3353},{"style":270},[3354],{"type":67,"value":3355},"function",{"type":61,"tag":206,"props":3357,"children":3358},{"style":291},[3359],{"type":67,"value":3360}," estimateTokens",{"type":61,"tag":206,"props":3362,"children":3363},{"style":219},[3364],{"type":67,"value":298},{"type":61,"tag":206,"props":3366,"children":3368},{"style":3367},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[3369],{"type":67,"value":67},{"type":61,"tag":206,"props":3371,"children":3372},{"style":219},[3373],{"type":67,"value":318},{"type":61,"tag":206,"props":3375,"children":3376},{"style":870},[3377],{"type":67,"value":3378}," string",{"type":61,"tag":206,"props":3380,"children":3381},{"style":219},[3382],{"type":67,"value":3383},"):",{"type":61,"tag":206,"props":3385,"children":3386},{"style":870},[3387],{"type":67,"value":3388}," number",{"type":61,"tag":206,"props":3390,"children":3391},{"style":219},[3392],{"type":67,"value":1300},{"type":61,"tag":206,"props":3394,"children":3395},{"class":208,"line":306},[3396,3401,3406,3410,3415,3419,3423,3427,3432,3437,3442,3446],{"type":61,"tag":206,"props":3397,"children":3398},{"style":213},[3399],{"type":67,"value":3400},"  return",{"type":61,"tag":206,"props":3402,"children":3403},{"style":225},[3404],{"type":67,"value":3405}," Math",{"type":61,"tag":206,"props":3407,"children":3408},{"style":219},[3409],{"type":67,"value":724},{"type":61,"tag":206,"props":3411,"children":3412},{"style":291},[3413],{"type":67,"value":3414},"ceil",{"type":61,"tag":206,"props":3416,"children":3417},{"style":310},[3418],{"type":67,"value":298},{"type":61,"tag":206,"props":3420,"children":3421},{"style":225},[3422],{"type":67,"value":67},{"type":61,"tag":206,"props":3424,"children":3425},{"style":219},[3426],{"type":67,"value":724},{"type":61,"tag":206,"props":3428,"children":3429},{"style":225},[3430],{"type":67,"value":3431},"length",{"type":61,"tag":206,"props":3433,"children":3434},{"style":219},[3435],{"type":67,"value":3436}," \u002F",{"type":61,"tag":206,"props":3438,"children":3439},{"style":2780},[3440],{"type":67,"value":3441}," 4",{"type":61,"tag":206,"props":3443,"children":3444},{"style":310},[3445],{"type":67,"value":2753},{"type":61,"tag":206,"props":3447,"children":3448},{"style":340},[3449],{"type":67,"value":3450},"\u002F\u002F rough estimate\n",{"type":61,"tag":206,"props":3452,"children":3453},{"class":208,"line":346},[3454],{"type":61,"tag":206,"props":3455,"children":3456},{"style":219},[3457],{"type":67,"value":3002},{"type":61,"tag":206,"props":3459,"children":3460},{"class":208,"line":377},[3461],{"type":61,"tag":206,"props":3462,"children":3463},{"emptyLinePlaceholder":260},[3464],{"type":67,"value":263},{"type":61,"tag":206,"props":3466,"children":3467},{"class":208,"line":42},[3468,3473,3478,3483,3487,3492,3496,3500,3504,3509,3513,3517,3521],{"type":61,"tag":206,"props":3469,"children":3470},{"style":270},[3471],{"type":67,"value":3472},"async",{"type":61,"tag":206,"props":3474,"children":3475},{"style":270},[3476],{"type":67,"value":3477}," function",{"type":61,"tag":206,"props":3479,"children":3480},{"style":291},[3481],{"type":67,"value":3482}," callWithBudget",{"type":61,"tag":206,"props":3484,"children":3485},{"style":219},[3486],{"type":67,"value":298},{"type":61,"tag":206,"props":3488,"children":3489},{"style":3367},[3490],{"type":67,"value":3491},"prompt",{"type":61,"tag":206,"props":3493,"children":3494},{"style":219},[3495],{"type":67,"value":318},{"type":61,"tag":206,"props":3497,"children":3498},{"style":870},[3499],{"type":67,"value":3378},{"type":61,"tag":206,"props":3501,"children":3502},{"style":219},[3503],{"type":67,"value":337},{"type":61,"tag":206,"props":3505,"children":3506},{"style":3367},[3507],{"type":67,"value":3508}," maxTokens",{"type":61,"tag":206,"props":3510,"children":3511},{"style":219},[3512],{"type":67,"value":318},{"type":61,"tag":206,"props":3514,"children":3515},{"style":870},[3516],{"type":67,"value":3388},{"type":61,"tag":206,"props":3518,"children":3519},{"style":219},[3520],{"type":67,"value":533},{"type":61,"tag":206,"props":3522,"children":3523},{"style":219},[3524],{"type":67,"value":1300},{"type":61,"tag":206,"props":3526,"children":3527},{"class":208,"line":1382},[3528,3532,3537,3541,3545,3549,3553],{"type":61,"tag":206,"props":3529,"children":3530},{"style":270},[3531],{"type":67,"value":2545},{"type":61,"tag":206,"props":3533,"children":3534},{"style":225},[3535],{"type":67,"value":3536}," estimated",{"type":61,"tag":206,"props":3538,"children":3539},{"style":219},[3540],{"type":67,"value":2555},{"type":61,"tag":206,"props":3542,"children":3543},{"style":291},[3544],{"type":67,"value":3360},{"type":61,"tag":206,"props":3546,"children":3547},{"style":310},[3548],{"type":67,"value":298},{"type":61,"tag":206,"props":3550,"children":3551},{"style":225},[3552],{"type":67,"value":3491},{"type":61,"tag":206,"props":3554,"children":3555},{"style":310},[3556],{"type":67,"value":388},{"type":61,"tag":206,"props":3558,"children":3559},{"class":208,"line":1390},[3560,3564,3568,3573,3578,3582,3586],{"type":61,"tag":206,"props":3561,"children":3562},{"style":213},[3563],{"type":67,"value":2721},{"type":61,"tag":206,"props":3565,"children":3566},{"style":310},[3567],{"type":67,"value":974},{"type":61,"tag":206,"props":3569,"children":3570},{"style":225},[3571],{"type":67,"value":3572},"estimated",{"type":61,"tag":206,"props":3574,"children":3575},{"style":219},[3576],{"type":67,"value":3577}," >",{"type":61,"tag":206,"props":3579,"children":3580},{"style":225},[3581],{"type":67,"value":3508},{"type":61,"tag":206,"props":3583,"children":3584},{"style":310},[3585],{"type":67,"value":2753},{"type":61,"tag":206,"props":3587,"children":3588},{"style":219},[3589],{"type":67,"value":303},{"type":61,"tag":206,"props":3591,"children":3592},{"class":208,"line":1399},[3593,3598,3602,3607,3611,3616,3621,3626,3630,3634,3639,3643,3648,3652,3657,3661],{"type":61,"tag":206,"props":3594,"children":3595},{"style":213},[3596],{"type":67,"value":3597},"    throw",{"type":61,"tag":206,"props":3599,"children":3600},{"style":219},[3601],{"type":67,"value":2862},{"type":61,"tag":206,"props":3603,"children":3604},{"style":291},[3605],{"type":67,"value":3606}," Error",{"type":61,"tag":206,"props":3608,"children":3609},{"style":310},[3610],{"type":67,"value":298},{"type":61,"tag":206,"props":3612,"children":3613},{"style":219},[3614],{"type":67,"value":3615},"`",{"type":61,"tag":206,"props":3617,"children":3618},{"style":246},[3619],{"type":67,"value":3620},"Prompt too large: ~",{"type":61,"tag":206,"props":3622,"children":3623},{"style":219},[3624],{"type":67,"value":3625},"${",{"type":61,"tag":206,"props":3627,"children":3628},{"style":225},[3629],{"type":67,"value":3572},{"type":61,"tag":206,"props":3631,"children":3632},{"style":219},[3633],{"type":67,"value":383},{"type":61,"tag":206,"props":3635,"children":3636},{"style":246},[3637],{"type":67,"value":3638}," tokens exceeds ",{"type":61,"tag":206,"props":3640,"children":3641},{"style":219},[3642],{"type":67,"value":3625},{"type":61,"tag":206,"props":3644,"children":3645},{"style":225},[3646],{"type":67,"value":3647},"maxTokens",{"type":61,"tag":206,"props":3649,"children":3650},{"style":219},[3651],{"type":67,"value":383},{"type":61,"tag":206,"props":3653,"children":3654},{"style":246},[3655],{"type":67,"value":3656}," limit",{"type":61,"tag":206,"props":3658,"children":3659},{"style":219},[3660],{"type":67,"value":3615},{"type":61,"tag":206,"props":3662,"children":3663},{"style":310},[3664],{"type":67,"value":388},{"type":61,"tag":206,"props":3666,"children":3667},{"class":208,"line":1453},[3668],{"type":61,"tag":206,"props":3669,"children":3670},{"style":219},[3671],{"type":67,"value":2981},{"type":61,"tag":206,"props":3673,"children":3674},{"class":208,"line":1461},[3675,3679,3683,3687,3691,3696,3700,3704,3708,3712,3716,3721,3725],{"type":61,"tag":206,"props":3676,"children":3677},{"style":213},[3678],{"type":67,"value":3400},{"type":61,"tag":206,"props":3680,"children":3681},{"style":291},[3682],{"type":67,"value":228},{"type":61,"tag":206,"props":3684,"children":3685},{"style":310},[3686],{"type":67,"value":298},{"type":61,"tag":206,"props":3688,"children":3689},{"style":219},[3690],{"type":67,"value":2898},{"type":61,"tag":206,"props":3692,"children":3693},{"style":310},[3694],{"type":67,"value":3695}," model",{"type":61,"tag":206,"props":3697,"children":3698},{"style":219},[3699],{"type":67,"value":318},{"type":61,"tag":206,"props":3701,"children":3702},{"style":219},[3703],{"type":67,"value":243},{"type":61,"tag":206,"props":3705,"children":3706},{"style":246},[3707],{"type":67,"value":327},{"type":61,"tag":206,"props":3709,"children":3710},{"style":219},[3711],{"type":67,"value":332},{"type":61,"tag":206,"props":3713,"children":3714},{"style":219},[3715],{"type":67,"value":337},{"type":61,"tag":206,"props":3717,"children":3718},{"style":225},[3719],{"type":67,"value":3720}," prompt",{"type":61,"tag":206,"props":3722,"children":3723},{"style":219},[3724],{"type":67,"value":233},{"type":61,"tag":206,"props":3726,"children":3727},{"style":310},[3728],{"type":67,"value":388},{"type":61,"tag":206,"props":3730,"children":3731},{"class":208,"line":1470},[3732],{"type":61,"tag":206,"props":3733,"children":3734},{"style":219},[3735],{"type":67,"value":3002},{"type":61,"tag":74,"props":3737,"children":3738},{},[3739,3741,3747],{"type":67,"value":3740},"The AI SDK's ",{"type":61,"tag":141,"props":3742,"children":3744},{"className":3743},[],[3745],{"type":67,"value":3746},"usage",{"type":67,"value":3748}," field on responses gives actual token counts after each request — store these for historical tracking and cost analysis.",{"type":61,"tag":851,"props":3750,"children":3752},{"id":3751},"hard-spending-limits",[3753],{"type":67,"value":3754},"Hard spending limits",{"type":61,"tag":74,"props":3756,"children":3757},{},[3758],{"type":67,"value":3759},"When a hard limit is reached, the gateway returns HTTP 402 (Payment Required). Handle this gracefully:",{"type":61,"tag":195,"props":3761,"children":3763},{"className":197,"code":3762,"language":199,"meta":200,"style":200},"if (APICallError.isInstance(error) && error.statusCode === 402) {\n  \u002F\u002F Budget exceeded — degrade gracefully\n  return fallbackResponse()\n}\n",[3764],{"type":61,"tag":141,"props":3765,"children":3766},{"__ignoreMap":200},[3767,3828,3836,3852],{"type":61,"tag":206,"props":3768,"children":3769},{"class":208,"line":209},[3770,3775,3780,3784,3788,3793,3797,3801,3805,3810,3815,3820,3824],{"type":61,"tag":206,"props":3771,"children":3772},{"style":213},[3773],{"type":67,"value":3774},"if",{"type":61,"tag":206,"props":3776,"children":3777},{"style":225},[3778],{"type":67,"value":3779}," (APICallError",{"type":61,"tag":206,"props":3781,"children":3782},{"style":219},[3783],{"type":67,"value":724},{"type":61,"tag":206,"props":3785,"children":3786},{"style":291},[3787],{"type":67,"value":2739},{"type":61,"tag":206,"props":3789,"children":3790},{"style":225},[3791],{"type":67,"value":3792},"(error) ",{"type":61,"tag":206,"props":3794,"children":3795},{"style":219},[3796],{"type":67,"value":2758},{"type":61,"tag":206,"props":3798,"children":3799},{"style":225},[3800],{"type":67,"value":2763},{"type":61,"tag":206,"props":3802,"children":3803},{"style":219},[3804],{"type":67,"value":724},{"type":61,"tag":206,"props":3806,"children":3807},{"style":225},[3808],{"type":67,"value":3809},"statusCode ",{"type":61,"tag":206,"props":3811,"children":3812},{"style":219},[3813],{"type":67,"value":3814},"===",{"type":61,"tag":206,"props":3816,"children":3817},{"style":2780},[3818],{"type":67,"value":3819}," 402",{"type":61,"tag":206,"props":3821,"children":3822},{"style":225},[3823],{"type":67,"value":2753},{"type":61,"tag":206,"props":3825,"children":3826},{"style":219},[3827],{"type":67,"value":303},{"type":61,"tag":206,"props":3829,"children":3830},{"class":208,"line":256},[3831],{"type":61,"tag":206,"props":3832,"children":3833},{"style":340},[3834],{"type":67,"value":3835},"  \u002F\u002F Budget exceeded — degrade gracefully\n",{"type":61,"tag":206,"props":3837,"children":3838},{"class":208,"line":266},[3839,3843,3848],{"type":61,"tag":206,"props":3840,"children":3841},{"style":213},[3842],{"type":67,"value":3400},{"type":61,"tag":206,"props":3844,"children":3845},{"style":291},[3846],{"type":67,"value":3847}," fallbackResponse",{"type":61,"tag":206,"props":3849,"children":3850},{"style":310},[3851],{"type":67,"value":823},{"type":61,"tag":206,"props":3853,"children":3854},{"class":208,"line":306},[3855],{"type":61,"tag":206,"props":3856,"children":3857},{"style":219},[3858],{"type":67,"value":3002},{"type":61,"tag":851,"props":3860,"children":3862},{"id":3861},"cost-optimization-patterns",[3863],{"type":67,"value":3864},"Cost optimization patterns",{"type":61,"tag":133,"props":3866,"children":3867},{},[3868,3873,3878,3883],{"type":61,"tag":137,"props":3869,"children":3870},{},[3871],{"type":67,"value":3872},"Use cheaper models for classification\u002Frouting, expensive models for generation",{"type":61,"tag":137,"props":3874,"children":3875},{},[3876],{"type":67,"value":3877},"Cache embeddings and static queries (see Cache-Control above)",{"type":61,"tag":137,"props":3879,"children":3880},{},[3881],{"type":67,"value":3882},"Set per-user daily token caps to prevent runaway usage",{"type":61,"tag":137,"props":3884,"children":3885},{},[3886],{"type":67,"value":3887},"Monitor cost-per-feature with tags to identify optimization targets",{"type":61,"tag":115,"props":3889,"children":3891},{"id":3890},"audit-logging",[3892],{"type":67,"value":3893},"Audit Logging",{"type":61,"tag":74,"props":3895,"children":3896},{},[3897],{"type":67,"value":3898},"AI Gateway logs every request for compliance and debugging:",{"type":61,"tag":851,"props":3900,"children":3902},{"id":3901},"whats-logged",[3903],{"type":67,"value":3904},"What's logged",{"type":61,"tag":133,"props":3906,"children":3907},{},[3908,3913,3918,3923,3928,3933],{"type":61,"tag":137,"props":3909,"children":3910},{},[3911],{"type":67,"value":3912},"Timestamp, model, provider used",{"type":61,"tag":137,"props":3914,"children":3915},{},[3916],{"type":67,"value":3917},"Input\u002Foutput token counts",{"type":61,"tag":137,"props":3919,"children":3920},{},[3921],{"type":67,"value":3922},"Latency (routing + provider)",{"type":61,"tag":137,"props":3924,"children":3925},{},[3926],{"type":67,"value":3927},"User ID and tags",{"type":61,"tag":137,"props":3929,"children":3930},{},[3931],{"type":67,"value":3932},"HTTP status code",{"type":61,"tag":137,"props":3934,"children":3935},{},[3936],{"type":67,"value":3937},"Failover chain (which providers were tried)",{"type":61,"tag":851,"props":3939,"children":3941},{"id":3940},"accessing-logs",[3942],{"type":67,"value":3943},"Accessing logs",{"type":61,"tag":133,"props":3945,"children":3946},{},[3947,3970],{"type":61,"tag":137,"props":3948,"children":3949},{},[3950,3955,3956,3962,3963,3968],{"type":61,"tag":78,"props":3951,"children":3952},{},[3953],{"type":67,"value":3954},"Vercel Dashboard",{"type":67,"value":91},{"type":61,"tag":141,"props":3957,"children":3959},{"className":3958},[],[3960],{"type":67,"value":3961},"https:\u002F\u002Fvercel.com\u002F{team}\u002F{project}\u002Fai",{"type":67,"value":2411},{"type":61,"tag":78,"props":3964,"children":3965},{},[3966],{"type":67,"value":3967},"Logs",{"type":67,"value":3969}," — filter by model, user, tag, status, date range",{"type":61,"tag":137,"props":3971,"children":3972},{},[3973,3978],{"type":61,"tag":78,"props":3974,"children":3975},{},[3976],{"type":67,"value":3977},"Vercel API",{"type":67,"value":3979},": Query logs programmatically:",{"type":61,"tag":195,"props":3981,"children":3983},{"className":858,"code":3982,"language":860,"meta":200,"style":200},"curl -H \"Authorization: Bearer $VERCEL_TOKEN\" \\\n  \"https:\u002F\u002Fapi.vercel.com\u002Fv1\u002Fai-gateway\u002Flogs?projectId=$PROJECT_ID&limit=100\"\n",[3984],{"type":61,"tag":141,"props":3985,"children":3986},{"__ignoreMap":200},[3987,4025],{"type":61,"tag":206,"props":3988,"children":3989},{"class":208,"line":209},[3990,3995,4000,4005,4010,4015,4020],{"type":61,"tag":206,"props":3991,"children":3992},{"style":870},[3993],{"type":67,"value":3994},"curl",{"type":61,"tag":206,"props":3996,"children":3997},{"style":246},[3998],{"type":67,"value":3999}," -H",{"type":61,"tag":206,"props":4001,"children":4002},{"style":219},[4003],{"type":67,"value":4004}," \"",{"type":61,"tag":206,"props":4006,"children":4007},{"style":246},[4008],{"type":67,"value":4009},"Authorization: Bearer ",{"type":61,"tag":206,"props":4011,"children":4012},{"style":225},[4013],{"type":67,"value":4014},"$VERCEL_TOKEN",{"type":61,"tag":206,"props":4016,"children":4017},{"style":219},[4018],{"type":67,"value":4019},"\"",{"type":61,"tag":206,"props":4021,"children":4022},{"style":225},[4023],{"type":67,"value":4024}," \\\n",{"type":61,"tag":206,"props":4026,"children":4027},{"class":208,"line":256},[4028,4033,4038,4043,4048],{"type":61,"tag":206,"props":4029,"children":4030},{"style":219},[4031],{"type":67,"value":4032},"  \"",{"type":61,"tag":206,"props":4034,"children":4035},{"style":246},[4036],{"type":67,"value":4037},"https:\u002F\u002Fapi.vercel.com\u002Fv1\u002Fai-gateway\u002Flogs?projectId=",{"type":61,"tag":206,"props":4039,"children":4040},{"style":225},[4041],{"type":67,"value":4042},"$PROJECT_ID",{"type":61,"tag":206,"props":4044,"children":4045},{"style":246},[4046],{"type":67,"value":4047},"&limit=100",{"type":61,"tag":206,"props":4049,"children":4050},{"style":219},[4051],{"type":67,"value":4052},"\"\n",{"type":61,"tag":133,"props":4054,"children":4055},{},[4056],{"type":61,"tag":137,"props":4057,"children":4058},{},[4059,4064,4066,4072],{"type":61,"tag":78,"props":4060,"children":4061},{},[4062],{"type":67,"value":4063},"Log Drains",{"type":67,"value":4065},": Forward AI Gateway logs to Datadog, Splunk, or other providers via Vercel Log Drains (configure at ",{"type":61,"tag":141,"props":4067,"children":4069},{"className":4068},[],[4070],{"type":67,"value":4071},"https:\u002F\u002Fvercel.com\u002Fdashboard\u002F{team}\u002F~\u002Fsettings\u002Flog-drains",{"type":67,"value":4073},") for long-term retention and custom analysis",{"type":61,"tag":851,"props":4075,"children":4077},{"id":4076},"compliance-considerations",[4078],{"type":67,"value":4079},"Compliance considerations",{"type":61,"tag":133,"props":4081,"children":4082},{},[4083,4088,4093,4098],{"type":61,"tag":137,"props":4084,"children":4085},{},[4086],{"type":67,"value":4087},"AI Gateway does not log prompt or completion content by default",{"type":61,"tag":137,"props":4089,"children":4090},{},[4091],{"type":67,"value":4092},"Enable content logging in project settings if required for compliance",{"type":61,"tag":137,"props":4094,"children":4095},{},[4096],{"type":67,"value":4097},"Logs are retained per your Vercel plan's retention policy",{"type":61,"tag":137,"props":4099,"children":4100},{},[4101,4102,4107],{"type":67,"value":3262},{"type":61,"tag":141,"props":4103,"children":4105},{"className":4104},[],[4106],{"type":67,"value":1784},{"type":67,"value":4108}," field consistently to support audit trails",{"type":61,"tag":115,"props":4110,"children":4112},{"id":4111},"error-handling-patterns",[4113],{"type":67,"value":4114},"Error Handling Patterns",{"type":61,"tag":851,"props":4116,"children":4118},{"id":4117},"provider-unavailable",[4119],{"type":67,"value":4120},"Provider unavailable",{"type":61,"tag":74,"props":4122,"children":4123},{},[4124,4126,4131,4132,4137],{"type":67,"value":4125},"When a provider is down, the gateway automatically fails over if you configured ",{"type":61,"tag":141,"props":4127,"children":4129},{"className":4128},[],[4130],{"type":67,"value":1733},{"type":67,"value":717},{"type":61,"tag":141,"props":4133,"children":4135},{"className":4134},[],[4136],{"type":67,"value":1767},{"type":67,"value":318},{"type":61,"tag":195,"props":4139,"children":4141},{"className":197,"code":4140,"language":199,"meta":200,"style":200},"const result = await generateText({\n  model: gateway('anthropic\u002Fclaude-sonnet-4.6'),\n  prompt: 'Summarize this document',\n  providerOptions: {\n    gateway: {\n      order: ['anthropic', 'bedrock'], \u002F\u002F Bedrock as fallback\n      models: ['openai\u002Fgpt-5.4'],   \u002F\u002F Final fallback model\n    },\n  },\n})\n",[4142],{"type":61,"tag":141,"props":4143,"children":4144},{"__ignoreMap":200},[4145,4176,4215,4243,4258,4273,4329,4369,4376,4383],{"type":61,"tag":206,"props":4146,"children":4147},{"class":208,"line":209},[4148,4152,4156,4160,4164,4168,4172],{"type":61,"tag":206,"props":4149,"children":4150},{"style":270},[4151],{"type":67,"value":273},{"type":61,"tag":206,"props":4153,"children":4154},{"style":225},[4155],{"type":67,"value":278},{"type":61,"tag":206,"props":4157,"children":4158},{"style":219},[4159],{"type":67,"value":283},{"type":61,"tag":206,"props":4161,"children":4162},{"style":213},[4163],{"type":67,"value":288},{"type":61,"tag":206,"props":4165,"children":4166},{"style":291},[4167],{"type":67,"value":228},{"type":61,"tag":206,"props":4169,"children":4170},{"style":225},[4171],{"type":67,"value":298},{"type":61,"tag":206,"props":4173,"children":4174},{"style":219},[4175],{"type":67,"value":303},{"type":61,"tag":206,"props":4177,"children":4178},{"class":208,"line":256},[4179,4183,4187,4191,4195,4199,4203,4207,4211],{"type":61,"tag":206,"props":4180,"children":4181},{"style":310},[4182],{"type":67,"value":313},{"type":61,"tag":206,"props":4184,"children":4185},{"style":219},[4186],{"type":67,"value":318},{"type":61,"tag":206,"props":4188,"children":4189},{"style":291},[4190],{"type":67,"value":439},{"type":61,"tag":206,"props":4192,"children":4193},{"style":225},[4194],{"type":67,"value":298},{"type":61,"tag":206,"props":4196,"children":4197},{"style":219},[4198],{"type":67,"value":332},{"type":61,"tag":206,"props":4200,"children":4201},{"style":246},[4202],{"type":67,"value":681},{"type":61,"tag":206,"props":4204,"children":4205},{"style":219},[4206],{"type":67,"value":332},{"type":61,"tag":206,"props":4208,"children":4209},{"style":225},[4210],{"type":67,"value":533},{"type":61,"tag":206,"props":4212,"children":4213},{"style":219},[4214],{"type":67,"value":374},{"type":61,"tag":206,"props":4216,"children":4217},{"class":208,"line":266},[4218,4222,4226,4230,4235,4239],{"type":61,"tag":206,"props":4219,"children":4220},{"style":310},[4221],{"type":67,"value":352},{"type":61,"tag":206,"props":4223,"children":4224},{"style":219},[4225],{"type":67,"value":318},{"type":61,"tag":206,"props":4227,"children":4228},{"style":219},[4229],{"type":67,"value":243},{"type":61,"tag":206,"props":4231,"children":4232},{"style":246},[4233],{"type":67,"value":4234},"Summarize this document",{"type":61,"tag":206,"props":4236,"children":4237},{"style":219},[4238],{"type":67,"value":332},{"type":61,"tag":206,"props":4240,"children":4241},{"style":219},[4242],{"type":67,"value":374},{"type":61,"tag":206,"props":4244,"children":4245},{"class":208,"line":306},[4246,4250,4254],{"type":61,"tag":206,"props":4247,"children":4248},{"style":310},[4249],{"type":67,"value":545},{"type":61,"tag":206,"props":4251,"children":4252},{"style":219},[4253],{"type":67,"value":318},{"type":61,"tag":206,"props":4255,"children":4256},{"style":219},[4257],{"type":67,"value":1300},{"type":61,"tag":206,"props":4259,"children":4260},{"class":208,"line":346},[4261,4265,4269],{"type":61,"tag":206,"props":4262,"children":4263},{"style":310},[4264],{"type":67,"value":1308},{"type":61,"tag":206,"props":4266,"children":4267},{"style":219},[4268],{"type":67,"value":318},{"type":61,"tag":206,"props":4270,"children":4271},{"style":219},[4272],{"type":67,"value":1300},{"type":61,"tag":206,"props":4274,"children":4275},{"class":208,"line":377},[4276,4280,4284,4288,4292,4296,4300,4304,4308,4312,4316,4320,4324],{"type":61,"tag":206,"props":4277,"children":4278},{"style":310},[4279],{"type":67,"value":1332},{"type":61,"tag":206,"props":4281,"children":4282},{"style":219},[4283],{"type":67,"value":318},{"type":61,"tag":206,"props":4285,"children":4286},{"style":225},[4287],{"type":67,"value":579},{"type":61,"tag":206,"props":4289,"children":4290},{"style":219},[4291],{"type":67,"value":332},{"type":61,"tag":206,"props":4293,"children":4294},{"style":246},[4295],{"type":67,"value":1366},{"type":61,"tag":206,"props":4297,"children":4298},{"style":219},[4299],{"type":67,"value":332},{"type":61,"tag":206,"props":4301,"children":4302},{"style":219},[4303],{"type":67,"value":337},{"type":61,"tag":206,"props":4305,"children":4306},{"style":219},[4307],{"type":67,"value":243},{"type":61,"tag":206,"props":4309,"children":4310},{"style":246},[4311],{"type":67,"value":1349},{"type":61,"tag":206,"props":4313,"children":4314},{"style":219},[4315],{"type":67,"value":332},{"type":61,"tag":206,"props":4317,"children":4318},{"style":225},[4319],{"type":67,"value":1375},{"type":61,"tag":206,"props":4321,"children":4322},{"style":219},[4323],{"type":67,"value":337},{"type":61,"tag":206,"props":4325,"children":4326},{"style":340},[4327],{"type":67,"value":4328}," \u002F\u002F Bedrock as fallback\n",{"type":61,"tag":206,"props":4330,"children":4331},{"class":208,"line":42},[4332,4336,4340,4344,4348,4352,4356,4360,4364],{"type":61,"tag":206,"props":4333,"children":4334},{"style":310},[4335],{"type":67,"value":1476},{"type":61,"tag":206,"props":4337,"children":4338},{"style":219},[4339],{"type":67,"value":318},{"type":61,"tag":206,"props":4341,"children":4342},{"style":225},[4343],{"type":67,"value":579},{"type":61,"tag":206,"props":4345,"children":4346},{"style":219},[4347],{"type":67,"value":332},{"type":61,"tag":206,"props":4349,"children":4350},{"style":246},[4351],{"type":67,"value":327},{"type":61,"tag":206,"props":4353,"children":4354},{"style":219},[4355],{"type":67,"value":332},{"type":61,"tag":206,"props":4357,"children":4358},{"style":225},[4359],{"type":67,"value":1375},{"type":61,"tag":206,"props":4361,"children":4362},{"style":219},[4363],{"type":67,"value":337},{"type":61,"tag":206,"props":4365,"children":4366},{"style":340},[4367],{"type":67,"value":4368},"   \u002F\u002F Final fallback model\n",{"type":61,"tag":206,"props":4370,"children":4371},{"class":208,"line":1382},[4372],{"type":61,"tag":206,"props":4373,"children":4374},{"style":219},[4375],{"type":67,"value":1666},{"type":61,"tag":206,"props":4377,"children":4378},{"class":208,"line":1390},[4379],{"type":61,"tag":206,"props":4380,"children":4381},{"style":219},[4382],{"type":67,"value":1675},{"type":61,"tag":206,"props":4384,"children":4385},{"class":208,"line":1399},[4386,4390],{"type":61,"tag":206,"props":4387,"children":4388},{"style":219},[4389],{"type":67,"value":383},{"type":61,"tag":206,"props":4391,"children":4392},{"style":225},[4393],{"type":67,"value":388},{"type":61,"tag":851,"props":4395,"children":4397},{"id":4396},"quota-exceeded-at-provider",[4398],{"type":67,"value":4399},"Quota exceeded at provider",{"type":61,"tag":74,"props":4401,"children":4402},{},[4403,4405,4410],{"type":67,"value":4404},"If your provider API key hits its quota, the gateway tries the next provider in the ",{"type":61,"tag":141,"props":4406,"children":4408},{"className":4407},[],[4409],{"type":67,"value":1733},{"type":67,"value":4411}," list. Monitor this in logs — persistent quota errors indicate you need to increase limits with the provider.",{"type":61,"tag":851,"props":4413,"children":4415},{"id":4414},"invalid-model-identifier",[4416],{"type":67,"value":4417},"Invalid model identifier",{"type":61,"tag":195,"props":4419,"children":4421},{"className":197,"code":4420,"language":199,"meta":200,"style":200},"\u002F\u002F Bad — model doesn't exist\nmodel: 'openai\u002Fgpt-99'  \u002F\u002F Returns 400 with descriptive error\n\n\u002F\u002F Good — use models listed in Vercel docs\nmodel: 'openai\u002Fgpt-5.4'\n",[4422],{"type":61,"tag":141,"props":4423,"children":4424},{"__ignoreMap":200},[4425,4433,4462,4469,4477],{"type":61,"tag":206,"props":4426,"children":4427},{"class":208,"line":209},[4428],{"type":61,"tag":206,"props":4429,"children":4430},{"style":340},[4431],{"type":67,"value":4432},"\u002F\u002F Bad — model doesn't exist\n",{"type":61,"tag":206,"props":4434,"children":4435},{"class":208,"line":256},[4436,4440,4444,4448,4453,4457],{"type":61,"tag":206,"props":4437,"children":4438},{"style":870},[4439],{"type":67,"value":191},{"type":61,"tag":206,"props":4441,"children":4442},{"style":219},[4443],{"type":67,"value":318},{"type":61,"tag":206,"props":4445,"children":4446},{"style":219},[4447],{"type":67,"value":243},{"type":61,"tag":206,"props":4449,"children":4450},{"style":246},[4451],{"type":67,"value":4452},"openai\u002Fgpt-99",{"type":61,"tag":206,"props":4454,"children":4455},{"style":219},[4456],{"type":67,"value":332},{"type":61,"tag":206,"props":4458,"children":4459},{"style":340},[4460],{"type":67,"value":4461},"  \u002F\u002F Returns 400 with descriptive error\n",{"type":61,"tag":206,"props":4463,"children":4464},{"class":208,"line":266},[4465],{"type":61,"tag":206,"props":4466,"children":4467},{"emptyLinePlaceholder":260},[4468],{"type":67,"value":263},{"type":61,"tag":206,"props":4470,"children":4471},{"class":208,"line":306},[4472],{"type":61,"tag":206,"props":4473,"children":4474},{"style":340},[4475],{"type":67,"value":4476},"\u002F\u002F Good — use models listed in Vercel docs\n",{"type":61,"tag":206,"props":4478,"children":4479},{"class":208,"line":346},[4480,4484,4488,4492,4496],{"type":61,"tag":206,"props":4481,"children":4482},{"style":870},[4483],{"type":67,"value":191},{"type":61,"tag":206,"props":4485,"children":4486},{"style":219},[4487],{"type":67,"value":318},{"type":61,"tag":206,"props":4489,"children":4490},{"style":219},[4491],{"type":67,"value":243},{"type":61,"tag":206,"props":4493,"children":4494},{"style":246},[4495],{"type":67,"value":327},{"type":61,"tag":206,"props":4497,"children":4498},{"style":219},[4499],{"type":67,"value":253},{"type":61,"tag":851,"props":4501,"children":4503},{"id":4502},"timeout-handling",[4504],{"type":67,"value":4505},"Timeout handling",{"type":61,"tag":74,"props":4507,"children":4508},{},[4509],{"type":67,"value":4510},"Gateway has a default timeout per provider. For long-running generations, use streaming:",{"type":61,"tag":195,"props":4512,"children":4514},{"className":197,"code":4513,"language":199,"meta":200,"style":200},"import { streamText } from 'ai'\n\nconst result = streamText({\n  model: 'anthropic\u002Fclaude-sonnet-4.6',\n  prompt: longDocument,\n})\n\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk)\n}\n",[4515],{"type":61,"tag":141,"props":4516,"children":4517},{"__ignoreMap":200},[4518,4554,4561,4588,4615,4635,4646,4653,4700,4739],{"type":61,"tag":206,"props":4519,"children":4520},{"class":208,"line":209},[4521,4525,4529,4534,4538,4542,4546,4550],{"type":61,"tag":206,"props":4522,"children":4523},{"style":213},[4524],{"type":67,"value":216},{"type":61,"tag":206,"props":4526,"children":4527},{"style":219},[4528],{"type":67,"value":222},{"type":61,"tag":206,"props":4530,"children":4531},{"style":225},[4532],{"type":67,"value":4533}," streamText",{"type":61,"tag":206,"props":4535,"children":4536},{"style":219},[4537],{"type":67,"value":233},{"type":61,"tag":206,"props":4539,"children":4540},{"style":213},[4541],{"type":67,"value":238},{"type":61,"tag":206,"props":4543,"children":4544},{"style":219},[4545],{"type":67,"value":243},{"type":61,"tag":206,"props":4547,"children":4548},{"style":246},[4549],{"type":67,"value":49},{"type":61,"tag":206,"props":4551,"children":4552},{"style":219},[4553],{"type":67,"value":253},{"type":61,"tag":206,"props":4555,"children":4556},{"class":208,"line":256},[4557],{"type":61,"tag":206,"props":4558,"children":4559},{"emptyLinePlaceholder":260},[4560],{"type":67,"value":263},{"type":61,"tag":206,"props":4562,"children":4563},{"class":208,"line":266},[4564,4568,4572,4576,4580,4584],{"type":61,"tag":206,"props":4565,"children":4566},{"style":270},[4567],{"type":67,"value":273},{"type":61,"tag":206,"props":4569,"children":4570},{"style":225},[4571],{"type":67,"value":278},{"type":61,"tag":206,"props":4573,"children":4574},{"style":219},[4575],{"type":67,"value":283},{"type":61,"tag":206,"props":4577,"children":4578},{"style":291},[4579],{"type":67,"value":4533},{"type":61,"tag":206,"props":4581,"children":4582},{"style":225},[4583],{"type":67,"value":298},{"type":61,"tag":206,"props":4585,"children":4586},{"style":219},[4587],{"type":67,"value":303},{"type":61,"tag":206,"props":4589,"children":4590},{"class":208,"line":306},[4591,4595,4599,4603,4607,4611],{"type":61,"tag":206,"props":4592,"children":4593},{"style":310},[4594],{"type":67,"value":313},{"type":61,"tag":206,"props":4596,"children":4597},{"style":219},[4598],{"type":67,"value":318},{"type":61,"tag":206,"props":4600,"children":4601},{"style":219},[4602],{"type":67,"value":243},{"type":61,"tag":206,"props":4604,"children":4605},{"style":246},[4606],{"type":67,"value":681},{"type":61,"tag":206,"props":4608,"children":4609},{"style":219},[4610],{"type":67,"value":332},{"type":61,"tag":206,"props":4612,"children":4613},{"style":219},[4614],{"type":67,"value":374},{"type":61,"tag":206,"props":4616,"children":4617},{"class":208,"line":346},[4618,4622,4626,4631],{"type":61,"tag":206,"props":4619,"children":4620},{"style":310},[4621],{"type":67,"value":352},{"type":61,"tag":206,"props":4623,"children":4624},{"style":219},[4625],{"type":67,"value":318},{"type":61,"tag":206,"props":4627,"children":4628},{"style":225},[4629],{"type":67,"value":4630}," longDocument",{"type":61,"tag":206,"props":4632,"children":4633},{"style":219},[4634],{"type":67,"value":374},{"type":61,"tag":206,"props":4636,"children":4637},{"class":208,"line":377},[4638,4642],{"type":61,"tag":206,"props":4639,"children":4640},{"style":219},[4641],{"type":67,"value":383},{"type":61,"tag":206,"props":4643,"children":4644},{"style":225},[4645],{"type":67,"value":388},{"type":61,"tag":206,"props":4647,"children":4648},{"class":208,"line":42},[4649],{"type":61,"tag":206,"props":4650,"children":4651},{"emptyLinePlaceholder":260},[4652],{"type":67,"value":263},{"type":61,"tag":206,"props":4654,"children":4655},{"class":208,"line":1382},[4656,4661,4665,4669,4673,4678,4683,4687,4691,4696],{"type":61,"tag":206,"props":4657,"children":4658},{"style":213},[4659],{"type":67,"value":4660},"for",{"type":61,"tag":206,"props":4662,"children":4663},{"style":213},[4664],{"type":67,"value":288},{"type":61,"tag":206,"props":4666,"children":4667},{"style":225},[4668],{"type":67,"value":974},{"type":61,"tag":206,"props":4670,"children":4671},{"style":270},[4672],{"type":67,"value":273},{"type":61,"tag":206,"props":4674,"children":4675},{"style":225},[4676],{"type":67,"value":4677}," chunk ",{"type":61,"tag":206,"props":4679,"children":4680},{"style":219},[4681],{"type":67,"value":4682},"of",{"type":61,"tag":206,"props":4684,"children":4685},{"style":225},[4686],{"type":67,"value":2550},{"type":61,"tag":206,"props":4688,"children":4689},{"style":219},[4690],{"type":67,"value":724},{"type":61,"tag":206,"props":4692,"children":4693},{"style":225},[4694],{"type":67,"value":4695},"textStream) ",{"type":61,"tag":206,"props":4697,"children":4698},{"style":219},[4699],{"type":67,"value":303},{"type":61,"tag":206,"props":4701,"children":4702},{"class":208,"line":1390},[4703,4708,4712,4717,4721,4726,4730,4735],{"type":61,"tag":206,"props":4704,"children":4705},{"style":225},[4706],{"type":67,"value":4707},"  process",{"type":61,"tag":206,"props":4709,"children":4710},{"style":219},[4711],{"type":67,"value":724},{"type":61,"tag":206,"props":4713,"children":4714},{"style":225},[4715],{"type":67,"value":4716},"stdout",{"type":61,"tag":206,"props":4718,"children":4719},{"style":219},[4720],{"type":67,"value":724},{"type":61,"tag":206,"props":4722,"children":4723},{"style":291},[4724],{"type":67,"value":4725},"write",{"type":61,"tag":206,"props":4727,"children":4728},{"style":310},[4729],{"type":67,"value":298},{"type":61,"tag":206,"props":4731,"children":4732},{"style":225},[4733],{"type":67,"value":4734},"chunk",{"type":61,"tag":206,"props":4736,"children":4737},{"style":310},[4738],{"type":67,"value":388},{"type":61,"tag":206,"props":4740,"children":4741},{"class":208,"line":1399},[4742],{"type":61,"tag":206,"props":4743,"children":4744},{"style":219},[4745],{"type":67,"value":3002},{"type":61,"tag":851,"props":4747,"children":4749},{"id":4748},"complete-error-handling-template",[4750],{"type":67,"value":4751},"Complete error handling template",{"type":61,"tag":195,"props":4753,"children":4755},{"className":197,"code":4754,"language":199,"meta":200,"style":200},"import { generateText, APICallError } from 'ai'\n\nasync function callAI(prompt: string, userId: string) {\n  try {\n    return await generateText({\n      model: gateway('openai\u002Fgpt-5.4'),\n      prompt,\n      providerOptions: {\n        gateway: {\n          user: userId,\n          order: ['openai', 'azure-openai'],\n          models: ['anthropic\u002Fclaude-haiku-4.5'],\n          tags: ['feature:chat'],\n        },\n      },\n    })\n  } catch (error) {\n    if (!APICallError.isInstance(error)) throw error\n\n    switch (error.statusCode) {\n      case 402: return { text: 'Budget limit reached. Please try again later.' }\n      case 429: return { text: 'Too many requests. Please slow down.' }\n      case 503: return { text: 'AI service temporarily unavailable.' }\n      default: throw error\n    }\n  }\n}\n",[4756],{"type":61,"tag":141,"props":4757,"children":4758},{"__ignoreMap":200},[4759,4802,4809,4865,4877,4900,4940,4952,4968,4984,5004,5056,5093,5129,5137,5145,5157,5184,5235,5242,5274,5325,5373,5423,5445,5454,5462],{"type":61,"tag":206,"props":4760,"children":4761},{"class":208,"line":209},[4762,4766,4770,4774,4778,4782,4786,4790,4794,4798],{"type":61,"tag":206,"props":4763,"children":4764},{"style":213},[4765],{"type":67,"value":216},{"type":61,"tag":206,"props":4767,"children":4768},{"style":219},[4769],{"type":67,"value":222},{"type":61,"tag":206,"props":4771,"children":4772},{"style":225},[4773],{"type":67,"value":228},{"type":61,"tag":206,"props":4775,"children":4776},{"style":219},[4777],{"type":67,"value":337},{"type":61,"tag":206,"props":4779,"children":4780},{"style":225},[4781],{"type":67,"value":2498},{"type":61,"tag":206,"props":4783,"children":4784},{"style":219},[4785],{"type":67,"value":233},{"type":61,"tag":206,"props":4787,"children":4788},{"style":213},[4789],{"type":67,"value":238},{"type":61,"tag":206,"props":4791,"children":4792},{"style":219},[4793],{"type":67,"value":243},{"type":61,"tag":206,"props":4795,"children":4796},{"style":246},[4797],{"type":67,"value":49},{"type":61,"tag":206,"props":4799,"children":4800},{"style":219},[4801],{"type":67,"value":253},{"type":61,"tag":206,"props":4803,"children":4804},{"class":208,"line":256},[4805],{"type":61,"tag":206,"props":4806,"children":4807},{"emptyLinePlaceholder":260},[4808],{"type":67,"value":263},{"type":61,"tag":206,"props":4810,"children":4811},{"class":208,"line":266},[4812,4816,4820,4825,4829,4833,4837,4841,4845,4849,4853,4857,4861],{"type":61,"tag":206,"props":4813,"children":4814},{"style":270},[4815],{"type":67,"value":3472},{"type":61,"tag":206,"props":4817,"children":4818},{"style":270},[4819],{"type":67,"value":3477},{"type":61,"tag":206,"props":4821,"children":4822},{"style":291},[4823],{"type":67,"value":4824}," callAI",{"type":61,"tag":206,"props":4826,"children":4827},{"style":219},[4828],{"type":67,"value":298},{"type":61,"tag":206,"props":4830,"children":4831},{"style":3367},[4832],{"type":67,"value":3491},{"type":61,"tag":206,"props":4834,"children":4835},{"style":219},[4836],{"type":67,"value":318},{"type":61,"tag":206,"props":4838,"children":4839},{"style":870},[4840],{"type":67,"value":3378},{"type":61,"tag":206,"props":4842,"children":4843},{"style":219},[4844],{"type":67,"value":337},{"type":61,"tag":206,"props":4846,"children":4847},{"style":3367},[4848],{"type":67,"value":2323},{"type":61,"tag":206,"props":4850,"children":4851},{"style":219},[4852],{"type":67,"value":318},{"type":61,"tag":206,"props":4854,"children":4855},{"style":870},[4856],{"type":67,"value":3378},{"type":61,"tag":206,"props":4858,"children":4859},{"style":219},[4860],{"type":67,"value":533},{"type":61,"tag":206,"props":4862,"children":4863},{"style":219},[4864],{"type":67,"value":1300},{"type":61,"tag":206,"props":4866,"children":4867},{"class":208,"line":306},[4868,4873],{"type":61,"tag":206,"props":4869,"children":4870},{"style":213},[4871],{"type":67,"value":4872},"  try",{"type":61,"tag":206,"props":4874,"children":4875},{"style":219},[4876],{"type":67,"value":1300},{"type":61,"tag":206,"props":4878,"children":4879},{"class":208,"line":346},[4880,4884,4888,4892,4896],{"type":61,"tag":206,"props":4881,"children":4882},{"style":213},[4883],{"type":67,"value":2857},{"type":61,"tag":206,"props":4885,"children":4886},{"style":213},[4887],{"type":67,"value":288},{"type":61,"tag":206,"props":4889,"children":4890},{"style":291},[4891],{"type":67,"value":228},{"type":61,"tag":206,"props":4893,"children":4894},{"style":310},[4895],{"type":67,"value":298},{"type":61,"tag":206,"props":4897,"children":4898},{"style":219},[4899],{"type":67,"value":303},{"type":61,"tag":206,"props":4901,"children":4902},{"class":208,"line":377},[4903,4908,4912,4916,4920,4924,4928,4932,4936],{"type":61,"tag":206,"props":4904,"children":4905},{"style":310},[4906],{"type":67,"value":4907},"      model",{"type":61,"tag":206,"props":4909,"children":4910},{"style":219},[4911],{"type":67,"value":318},{"type":61,"tag":206,"props":4913,"children":4914},{"style":291},[4915],{"type":67,"value":439},{"type":61,"tag":206,"props":4917,"children":4918},{"style":310},[4919],{"type":67,"value":298},{"type":61,"tag":206,"props":4921,"children":4922},{"style":219},[4923],{"type":67,"value":332},{"type":61,"tag":206,"props":4925,"children":4926},{"style":246},[4927],{"type":67,"value":327},{"type":61,"tag":206,"props":4929,"children":4930},{"style":219},[4931],{"type":67,"value":332},{"type":61,"tag":206,"props":4933,"children":4934},{"style":310},[4935],{"type":67,"value":533},{"type":61,"tag":206,"props":4937,"children":4938},{"style":219},[4939],{"type":67,"value":374},{"type":61,"tag":206,"props":4941,"children":4942},{"class":208,"line":42},[4943,4948],{"type":61,"tag":206,"props":4944,"children":4945},{"style":225},[4946],{"type":67,"value":4947},"      prompt",{"type":61,"tag":206,"props":4949,"children":4950},{"style":219},[4951],{"type":67,"value":374},{"type":61,"tag":206,"props":4953,"children":4954},{"class":208,"line":1382},[4955,4960,4964],{"type":61,"tag":206,"props":4956,"children":4957},{"style":310},[4958],{"type":67,"value":4959},"      providerOptions",{"type":61,"tag":206,"props":4961,"children":4962},{"style":219},[4963],{"type":67,"value":318},{"type":61,"tag":206,"props":4965,"children":4966},{"style":219},[4967],{"type":67,"value":1300},{"type":61,"tag":206,"props":4969,"children":4970},{"class":208,"line":1390},[4971,4976,4980],{"type":61,"tag":206,"props":4972,"children":4973},{"style":310},[4974],{"type":67,"value":4975},"        gateway",{"type":61,"tag":206,"props":4977,"children":4978},{"style":219},[4979],{"type":67,"value":318},{"type":61,"tag":206,"props":4981,"children":4982},{"style":219},[4983],{"type":67,"value":1300},{"type":61,"tag":206,"props":4985,"children":4986},{"class":208,"line":1399},[4987,4992,4996,5000],{"type":61,"tag":206,"props":4988,"children":4989},{"style":310},[4990],{"type":67,"value":4991},"          user",{"type":61,"tag":206,"props":4993,"children":4994},{"style":219},[4995],{"type":67,"value":318},{"type":61,"tag":206,"props":4997,"children":4998},{"style":225},[4999],{"type":67,"value":2323},{"type":61,"tag":206,"props":5001,"children":5002},{"style":219},[5003],{"type":67,"value":374},{"type":61,"tag":206,"props":5005,"children":5006},{"class":208,"line":1453},[5007,5012,5016,5020,5024,5028,5032,5036,5040,5044,5048,5052],{"type":61,"tag":206,"props":5008,"children":5009},{"style":310},[5010],{"type":67,"value":5011},"          order",{"type":61,"tag":206,"props":5013,"children":5014},{"style":219},[5015],{"type":67,"value":318},{"type":61,"tag":206,"props":5017,"children":5018},{"style":310},[5019],{"type":67,"value":579},{"type":61,"tag":206,"props":5021,"children":5022},{"style":219},[5023],{"type":67,"value":332},{"type":61,"tag":206,"props":5025,"children":5026},{"style":246},[5027],{"type":67,"value":8},{"type":61,"tag":206,"props":5029,"children":5030},{"style":219},[5031],{"type":67,"value":332},{"type":61,"tag":206,"props":5033,"children":5034},{"style":219},[5035],{"type":67,"value":337},{"type":61,"tag":206,"props":5037,"children":5038},{"style":219},[5039],{"type":67,"value":243},{"type":61,"tag":206,"props":5041,"children":5042},{"style":246},[5043],{"type":67,"value":604},{"type":61,"tag":206,"props":5045,"children":5046},{"style":219},[5047],{"type":67,"value":332},{"type":61,"tag":206,"props":5049,"children":5050},{"style":310},[5051],{"type":67,"value":1375},{"type":61,"tag":206,"props":5053,"children":5054},{"style":219},[5055],{"type":67,"value":374},{"type":61,"tag":206,"props":5057,"children":5058},{"class":208,"line":1461},[5059,5064,5068,5072,5076,5081,5085,5089],{"type":61,"tag":206,"props":5060,"children":5061},{"style":310},[5062],{"type":67,"value":5063},"          models",{"type":61,"tag":206,"props":5065,"children":5066},{"style":219},[5067],{"type":67,"value":318},{"type":61,"tag":206,"props":5069,"children":5070},{"style":310},[5071],{"type":67,"value":579},{"type":61,"tag":206,"props":5073,"children":5074},{"style":219},[5075],{"type":67,"value":332},{"type":61,"tag":206,"props":5077,"children":5078},{"style":246},[5079],{"type":67,"value":5080},"anthropic\u002Fclaude-haiku-4.5",{"type":61,"tag":206,"props":5082,"children":5083},{"style":219},[5084],{"type":67,"value":332},{"type":61,"tag":206,"props":5086,"children":5087},{"style":310},[5088],{"type":67,"value":1375},{"type":61,"tag":206,"props":5090,"children":5091},{"style":219},[5092],{"type":67,"value":374},{"type":61,"tag":206,"props":5094,"children":5095},{"class":208,"line":1470},[5096,5101,5105,5109,5113,5117,5121,5125],{"type":61,"tag":206,"props":5097,"children":5098},{"style":310},[5099],{"type":67,"value":5100},"          tags",{"type":61,"tag":206,"props":5102,"children":5103},{"style":219},[5104],{"type":67,"value":318},{"type":61,"tag":206,"props":5106,"children":5107},{"style":310},[5108],{"type":67,"value":579},{"type":61,"tag":206,"props":5110,"children":5111},{"style":219},[5112],{"type":67,"value":332},{"type":61,"tag":206,"props":5114,"children":5115},{"style":246},[5116],{"type":67,"value":1611},{"type":61,"tag":206,"props":5118,"children":5119},{"style":219},[5120],{"type":67,"value":332},{"type":61,"tag":206,"props":5122,"children":5123},{"style":310},[5124],{"type":67,"value":1375},{"type":61,"tag":206,"props":5126,"children":5127},{"style":219},[5128],{"type":67,"value":374},{"type":61,"tag":206,"props":5130,"children":5131},{"class":208,"line":1524},[5132],{"type":61,"tag":206,"props":5133,"children":5134},{"style":219},[5135],{"type":67,"value":5136},"        },\n",{"type":61,"tag":206,"props":5138,"children":5139},{"class":208,"line":1532},[5140],{"type":61,"tag":206,"props":5141,"children":5142},{"style":219},[5143],{"type":67,"value":5144},"      },\n",{"type":61,"tag":206,"props":5146,"children":5147},{"class":208,"line":1541},[5148,5153],{"type":61,"tag":206,"props":5149,"children":5150},{"style":219},[5151],{"type":67,"value":5152},"    }",{"type":61,"tag":206,"props":5154,"children":5155},{"style":310},[5156],{"type":67,"value":388},{"type":61,"tag":206,"props":5158,"children":5159},{"class":208,"line":1571},[5160,5164,5168,5172,5176,5180],{"type":61,"tag":206,"props":5161,"children":5162},{"style":219},[5163],{"type":67,"value":2688},{"type":61,"tag":206,"props":5165,"children":5166},{"style":213},[5167],{"type":67,"value":2704},{"type":61,"tag":206,"props":5169,"children":5170},{"style":310},[5171],{"type":67,"value":974},{"type":61,"tag":206,"props":5173,"children":5174},{"style":225},[5175],{"type":67,"value":2748},{"type":61,"tag":206,"props":5177,"children":5178},{"style":310},[5179],{"type":67,"value":2753},{"type":61,"tag":206,"props":5181,"children":5182},{"style":219},[5183],{"type":67,"value":303},{"type":61,"tag":206,"props":5185,"children":5186},{"class":208,"line":1579},[5187,5192,5196,5201,5205,5209,5213,5217,5221,5226,5231],{"type":61,"tag":206,"props":5188,"children":5189},{"style":213},[5190],{"type":67,"value":5191},"    if",{"type":61,"tag":206,"props":5193,"children":5194},{"style":310},[5195],{"type":67,"value":974},{"type":61,"tag":206,"props":5197,"children":5198},{"style":219},[5199],{"type":67,"value":5200},"!",{"type":61,"tag":206,"props":5202,"children":5203},{"style":225},[5204],{"type":67,"value":2730},{"type":61,"tag":206,"props":5206,"children":5207},{"style":219},[5208],{"type":67,"value":724},{"type":61,"tag":206,"props":5210,"children":5211},{"style":291},[5212],{"type":67,"value":2739},{"type":61,"tag":206,"props":5214,"children":5215},{"style":310},[5216],{"type":67,"value":298},{"type":61,"tag":206,"props":5218,"children":5219},{"style":225},[5220],{"type":67,"value":2748},{"type":61,"tag":206,"props":5222,"children":5223},{"style":310},[5224],{"type":67,"value":5225},")) ",{"type":61,"tag":206,"props":5227,"children":5228},{"style":213},[5229],{"type":67,"value":5230},"throw",{"type":61,"tag":206,"props":5232,"children":5233},{"style":225},[5234],{"type":67,"value":2994},{"type":61,"tag":206,"props":5236,"children":5237},{"class":208,"line":1588},[5238],{"type":61,"tag":206,"props":5239,"children":5240},{"emptyLinePlaceholder":260},[5241],{"type":67,"value":263},{"type":61,"tag":206,"props":5243,"children":5244},{"class":208,"line":1660},[5245,5250,5254,5258,5262,5266,5270],{"type":61,"tag":206,"props":5246,"children":5247},{"style":213},[5248],{"type":67,"value":5249},"    switch",{"type":61,"tag":206,"props":5251,"children":5252},{"style":310},[5253],{"type":67,"value":974},{"type":61,"tag":206,"props":5255,"children":5256},{"style":225},[5257],{"type":67,"value":2748},{"type":61,"tag":206,"props":5259,"children":5260},{"style":219},[5261],{"type":67,"value":724},{"type":61,"tag":206,"props":5263,"children":5264},{"style":225},[5265],{"type":67,"value":2772},{"type":61,"tag":206,"props":5267,"children":5268},{"style":310},[5269],{"type":67,"value":2753},{"type":61,"tag":206,"props":5271,"children":5272},{"style":219},[5273],{"type":67,"value":303},{"type":61,"tag":206,"props":5275,"children":5276},{"class":208,"line":1669},[5277,5282,5286,5290,5295,5299,5304,5308,5312,5317,5321],{"type":61,"tag":206,"props":5278,"children":5279},{"style":213},[5280],{"type":67,"value":5281},"      case",{"type":61,"tag":206,"props":5283,"children":5284},{"style":2780},[5285],{"type":67,"value":3819},{"type":61,"tag":206,"props":5287,"children":5288},{"style":219},[5289],{"type":67,"value":318},{"type":61,"tag":206,"props":5291,"children":5292},{"style":213},[5293],{"type":67,"value":5294}," return",{"type":61,"tag":206,"props":5296,"children":5297},{"style":219},[5298],{"type":67,"value":222},{"type":61,"tag":206,"props":5300,"children":5301},{"style":310},[5302],{"type":67,"value":5303}," text",{"type":61,"tag":206,"props":5305,"children":5306},{"style":219},[5307],{"type":67,"value":318},{"type":61,"tag":206,"props":5309,"children":5310},{"style":219},[5311],{"type":67,"value":243},{"type":61,"tag":206,"props":5313,"children":5314},{"style":246},[5315],{"type":67,"value":5316},"Budget limit reached. Please try again later.",{"type":61,"tag":206,"props":5318,"children":5319},{"style":219},[5320],{"type":67,"value":332},{"type":61,"tag":206,"props":5322,"children":5323},{"style":219},[5324],{"type":67,"value":2965},{"type":61,"tag":206,"props":5326,"children":5327},{"class":208,"line":1678},[5328,5332,5336,5340,5344,5348,5352,5356,5360,5365,5369],{"type":61,"tag":206,"props":5329,"children":5330},{"style":213},[5331],{"type":67,"value":5281},{"type":61,"tag":206,"props":5333,"children":5334},{"style":2780},[5335],{"type":67,"value":2783},{"type":61,"tag":206,"props":5337,"children":5338},{"style":219},[5339],{"type":67,"value":318},{"type":61,"tag":206,"props":5341,"children":5342},{"style":213},[5343],{"type":67,"value":5294},{"type":61,"tag":206,"props":5345,"children":5346},{"style":219},[5347],{"type":67,"value":222},{"type":61,"tag":206,"props":5349,"children":5350},{"style":310},[5351],{"type":67,"value":5303},{"type":61,"tag":206,"props":5353,"children":5354},{"style":219},[5355],{"type":67,"value":318},{"type":61,"tag":206,"props":5357,"children":5358},{"style":219},[5359],{"type":67,"value":243},{"type":61,"tag":206,"props":5361,"children":5362},{"style":246},[5363],{"type":67,"value":5364},"Too many requests. Please slow down.",{"type":61,"tag":206,"props":5366,"children":5367},{"style":219},[5368],{"type":67,"value":332},{"type":61,"tag":206,"props":5370,"children":5371},{"style":219},[5372],{"type":67,"value":2965},{"type":61,"tag":206,"props":5374,"children":5376},{"class":208,"line":5375},23,[5377,5381,5386,5390,5394,5398,5402,5406,5410,5415,5419],{"type":61,"tag":206,"props":5378,"children":5379},{"style":213},[5380],{"type":67,"value":5281},{"type":61,"tag":206,"props":5382,"children":5383},{"style":2780},[5384],{"type":67,"value":5385}," 503",{"type":61,"tag":206,"props":5387,"children":5388},{"style":219},[5389],{"type":67,"value":318},{"type":61,"tag":206,"props":5391,"children":5392},{"style":213},[5393],{"type":67,"value":5294},{"type":61,"tag":206,"props":5395,"children":5396},{"style":219},[5397],{"type":67,"value":222},{"type":61,"tag":206,"props":5399,"children":5400},{"style":310},[5401],{"type":67,"value":5303},{"type":61,"tag":206,"props":5403,"children":5404},{"style":219},[5405],{"type":67,"value":318},{"type":61,"tag":206,"props":5407,"children":5408},{"style":219},[5409],{"type":67,"value":243},{"type":61,"tag":206,"props":5411,"children":5412},{"style":246},[5413],{"type":67,"value":5414},"AI service temporarily unavailable.",{"type":61,"tag":206,"props":5416,"children":5417},{"style":219},[5418],{"type":67,"value":332},{"type":61,"tag":206,"props":5420,"children":5421},{"style":219},[5422],{"type":67,"value":2965},{"type":61,"tag":206,"props":5424,"children":5426},{"class":208,"line":5425},24,[5427,5432,5436,5441],{"type":61,"tag":206,"props":5428,"children":5429},{"style":213},[5430],{"type":67,"value":5431},"      default",{"type":61,"tag":206,"props":5433,"children":5434},{"style":219},[5435],{"type":67,"value":318},{"type":61,"tag":206,"props":5437,"children":5438},{"style":213},[5439],{"type":67,"value":5440}," throw",{"type":61,"tag":206,"props":5442,"children":5443},{"style":225},[5444],{"type":67,"value":2994},{"type":61,"tag":206,"props":5446,"children":5448},{"class":208,"line":5447},25,[5449],{"type":61,"tag":206,"props":5450,"children":5451},{"style":219},[5452],{"type":67,"value":5453},"    }\n",{"type":61,"tag":206,"props":5455,"children":5457},{"class":208,"line":5456},26,[5458],{"type":61,"tag":206,"props":5459,"children":5460},{"style":219},[5461],{"type":67,"value":2981},{"type":61,"tag":206,"props":5463,"children":5465},{"class":208,"line":5464},27,[5466],{"type":61,"tag":206,"props":5467,"children":5468},{"style":219},[5469],{"type":67,"value":3002},{"type":61,"tag":115,"props":5471,"children":5473},{"id":5472},"gateway-vs-direct-provider-decision-tree",[5474],{"type":67,"value":5475},"Gateway vs Direct Provider — Decision Tree",{"type":61,"tag":74,"props":5477,"children":5478},{},[5479],{"type":67,"value":5480},"Use this to decide whether to route through AI Gateway or call a provider SDK directly:",{"type":61,"tag":195,"props":5482,"children":5486},{"className":5483,"code":5485,"language":67},[5484],"language-text","Need failover across providers?\n  └─ Yes → Use Gateway\n  └─ No\n      Need cost tracking \u002F budget alerts?\n        └─ Yes → Use Gateway\n        └─ No\n            Need per-user rate limiting?\n              └─ Yes → Use Gateway\n              └─ No\n                  Need audit logging?\n                    └─ Yes → Use Gateway\n                    └─ No\n                        Using a single provider with provider-specific features?\n                          └─ Yes → Use direct provider SDK\n                          └─ No → Use Gateway (simplifies code)\n",[5487],{"type":61,"tag":141,"props":5488,"children":5489},{"__ignoreMap":200},[5490],{"type":67,"value":5485},{"type":61,"tag":851,"props":5492,"children":5494},{"id":5493},"when-to-use-direct-provider-sdk",[5495],{"type":67,"value":5496},"When to use direct provider SDK",{"type":61,"tag":133,"props":5498,"children":5499},{},[5500,5505,5510],{"type":61,"tag":137,"props":5501,"children":5502},{},[5503],{"type":67,"value":5504},"You need provider-specific features not exposed through the gateway (e.g., Anthropic's computer use, OpenAI's custom fine-tuned model endpoints)",{"type":61,"tag":137,"props":5506,"children":5507},{},[5508],{"type":67,"value":5509},"You're self-hosting a model (e.g., vLLM, Ollama) that isn't registered with the gateway",{"type":61,"tag":137,"props":5511,"children":5512},{},[5513],{"type":67,"value":5514},"You need request-level control over HTTP transport (custom proxies, mTLS)",{"type":61,"tag":851,"props":5516,"children":5518},{"id":5517},"when-to-always-use-gateway",[5519],{"type":67,"value":5520},"When to always use Gateway",{"type":61,"tag":133,"props":5522,"children":5523},{},[5524,5529,5534],{"type":61,"tag":137,"props":5525,"children":5526},{},[5527],{"type":67,"value":5528},"Production applications — failover and observability are essential",{"type":61,"tag":137,"props":5530,"children":5531},{},[5532],{"type":67,"value":5533},"Multi-tenant SaaS — per-user tracking and rate limiting",{"type":61,"tag":137,"props":5535,"children":5536},{},[5537],{"type":67,"value":5538},"Teams with cost accountability — tag-based budgeting",{"type":61,"tag":115,"props":5540,"children":5542},{"id":5541},"latest-model-availability",[5543],{"type":67,"value":5544},"Latest Model Availability",{"type":61,"tag":74,"props":5546,"children":5547},{},[5548,5553],{"type":61,"tag":78,"props":5549,"children":5550},{},[5551],{"type":67,"value":5552},"GPT-5.4",{"type":67,"value":5554}," (added March 5, 2026) — agentic and reasoning leaps from GPT-5.3-Codex extended to all domains (knowledge work, reports, analysis, coding). Faster and more token-efficient than GPT-5.2.",{"type":61,"tag":1695,"props":5556,"children":5557},{},[5558,5584],{"type":61,"tag":1699,"props":5559,"children":5560},{},[5561],{"type":61,"tag":1703,"props":5562,"children":5563},{},[5564,5569,5574,5579],{"type":61,"tag":1707,"props":5565,"children":5566},{},[5567],{"type":67,"value":5568},"Model",{"type":61,"tag":1707,"props":5570,"children":5571},{},[5572],{"type":67,"value":5573},"Slug",{"type":61,"tag":1707,"props":5575,"children":5576},{},[5577],{"type":67,"value":5578},"Input",{"type":61,"tag":1707,"props":5580,"children":5581},{},[5582],{"type":67,"value":5583},"Output",{"type":61,"tag":1718,"props":5585,"children":5586},{},[5587,5612],{"type":61,"tag":1703,"props":5588,"children":5589},{},[5590,5594,5602,5607],{"type":61,"tag":1725,"props":5591,"children":5592},{},[5593],{"type":67,"value":5552},{"type":61,"tag":1725,"props":5595,"children":5596},{},[5597],{"type":61,"tag":141,"props":5598,"children":5600},{"className":5599},[],[5601],{"type":67,"value":327},{"type":61,"tag":1725,"props":5603,"children":5604},{},[5605],{"type":67,"value":5606},"$2.50\u002FM tokens",{"type":61,"tag":1725,"props":5608,"children":5609},{},[5610],{"type":67,"value":5611},"$15.00\u002FM tokens",{"type":61,"tag":1703,"props":5613,"children":5614},{},[5615,5620,5629,5634],{"type":61,"tag":1725,"props":5616,"children":5617},{},[5618],{"type":67,"value":5619},"GPT-5.4 Pro",{"type":61,"tag":1725,"props":5621,"children":5622},{},[5623],{"type":61,"tag":141,"props":5624,"children":5626},{"className":5625},[],[5627],{"type":67,"value":5628},"openai\u002Fgpt-5.4-pro",{"type":61,"tag":1725,"props":5630,"children":5631},{},[5632],{"type":67,"value":5633},"$30.00\u002FM tokens",{"type":61,"tag":1725,"props":5635,"children":5636},{},[5637],{"type":67,"value":5638},"$180.00\u002FM tokens",{"type":61,"tag":74,"props":5640,"children":5641},{},[5642],{"type":67,"value":5643},"GPT-5.4 Pro targets maximum performance on complex tasks. Use standard GPT-5.4 for most workloads.",{"type":61,"tag":115,"props":5645,"children":5647},{"id":5646},"supported-providers",[5648],{"type":67,"value":5649},"Supported Providers",{"type":61,"tag":133,"props":5651,"children":5652},{},[5653,5658,5663,5668,5673,5678,5683,5688,5693,5698,5703,5708,5713],{"type":61,"tag":137,"props":5654,"children":5655},{},[5656],{"type":67,"value":5657},"OpenAI (GPT-5.x including GPT-5.4 and GPT-5.4 Pro, o-series)",{"type":61,"tag":137,"props":5659,"children":5660},{},[5661],{"type":67,"value":5662},"Anthropic (4.x models)",{"type":61,"tag":137,"props":5664,"children":5665},{},[5666],{"type":67,"value":5667},"Google (Gemini)",{"type":61,"tag":137,"props":5669,"children":5670},{},[5671],{"type":67,"value":5672},"xAI (Grok)",{"type":61,"tag":137,"props":5674,"children":5675},{},[5676],{"type":67,"value":5677},"Mistral",{"type":61,"tag":137,"props":5679,"children":5680},{},[5681],{"type":67,"value":5682},"DeepSeek",{"type":61,"tag":137,"props":5684,"children":5685},{},[5686],{"type":67,"value":5687},"Amazon Bedrock",{"type":61,"tag":137,"props":5689,"children":5690},{},[5691],{"type":67,"value":5692},"Azure OpenAI",{"type":61,"tag":137,"props":5694,"children":5695},{},[5696],{"type":67,"value":5697},"Cohere",{"type":61,"tag":137,"props":5699,"children":5700},{},[5701],{"type":67,"value":5702},"Perplexity",{"type":61,"tag":137,"props":5704,"children":5705},{},[5706],{"type":67,"value":5707},"Alibaba (Qwen)",{"type":61,"tag":137,"props":5709,"children":5710},{},[5711],{"type":67,"value":5712},"Meta (Llama)",{"type":61,"tag":137,"props":5714,"children":5715},{},[5716],{"type":67,"value":5717},"And many more (100+ models total)",{"type":61,"tag":115,"props":5719,"children":5721},{"id":5720},"pricing",[5722],{"type":67,"value":5723},"Pricing",{"type":61,"tag":133,"props":5725,"children":5726},{},[5727,5737,5754,5771],{"type":61,"tag":137,"props":5728,"children":5729},{},[5730,5735],{"type":61,"tag":78,"props":5731,"children":5732},{},[5733],{"type":67,"value":5734},"Zero markup",{"type":67,"value":5736},": Tokens at exact provider list price — no middleman markup, whether using Vercel-managed keys or Bring Your Own Key (BYOK)",{"type":61,"tag":137,"props":5738,"children":5739},{},[5740,5745,5747,5752],{"type":61,"tag":78,"props":5741,"children":5742},{},[5743],{"type":67,"value":5744},"Free tier",{"type":67,"value":5746},": Every Vercel team gets ",{"type":61,"tag":78,"props":5748,"children":5749},{},[5750],{"type":67,"value":5751},"$5 of free AI Gateway credits per month",{"type":67,"value":5753}," (refreshes every 30 days, starts on first request). No commitment required — experiment with LLMs indefinitely on the free tier",{"type":61,"tag":137,"props":5755,"children":5756},{},[5757,5762,5764,5769],{"type":61,"tag":78,"props":5758,"children":5759},{},[5760],{"type":67,"value":5761},"Pay-as-you-go",{"type":67,"value":5763},": Beyond free credits, purchase AI Gateway Credits at any time with no obligation. Configure ",{"type":61,"tag":78,"props":5765,"children":5766},{},[5767],{"type":67,"value":5768},"auto top-up",{"type":67,"value":5770}," to automatically add credits when your balance falls below a threshold",{"type":61,"tag":137,"props":5772,"children":5773},{},[5774,5779],{"type":61,"tag":78,"props":5775,"children":5776},{},[5777],{"type":67,"value":5778},"BYOK",{"type":67,"value":5780},": Use your own provider API keys with zero fees from AI Gateway",{"type":61,"tag":115,"props":5782,"children":5784},{"id":5783},"multimodal-support",[5785],{"type":67,"value":5786},"Multimodal Support",{"type":61,"tag":74,"props":5788,"children":5789},{},[5790],{"type":67,"value":5791},"Text and image generation both route through the gateway. For embeddings, use a direct provider SDK.",{"type":61,"tag":195,"props":5793,"children":5795},{"className":197,"code":5794,"language":199,"meta":200,"style":200},"\u002F\u002F Text — through gateway\nconst { text } = await generateText({\n  model: 'openai\u002Fgpt-5.4',\n  prompt: 'Hello',\n})\n\n\u002F\u002F Image — through gateway (multimodal LLMs return images in result.files)\nconst result = await generateText({\n  model: 'google\u002Fgemini-3.1-flash-image-preview',\n  prompt: 'A sunset over the ocean',\n})\nconst images = result.files.filter((f) => f.mediaType?.startsWith('image\u002F'))\n\n\u002F\u002F Image-only models — through gateway with experimental_generateImage\nimport { experimental_generateImage as generateImage } from 'ai'\nconst { images: generated } = await generateImage({\n  model: 'google\u002Fimagen-4.0-generate-001',\n  prompt: 'A sunset',\n})\n",[5796],{"type":61,"tag":141,"props":5797,"children":5798},{"__ignoreMap":200},[5799,5807,5847,5874,5902,5913,5920,5928,5959,5987,6015,6026,6131,6138,6146,6192,6241,6269,6297],{"type":61,"tag":206,"props":5800,"children":5801},{"class":208,"line":209},[5802],{"type":61,"tag":206,"props":5803,"children":5804},{"style":340},[5805],{"type":67,"value":5806},"\u002F\u002F Text — through gateway\n",{"type":61,"tag":206,"props":5808,"children":5809},{"class":208,"line":256},[5810,5814,5818,5823,5827,5831,5835,5839,5843],{"type":61,"tag":206,"props":5811,"children":5812},{"style":270},[5813],{"type":67,"value":273},{"type":61,"tag":206,"props":5815,"children":5816},{"style":219},[5817],{"type":67,"value":222},{"type":61,"tag":206,"props":5819,"children":5820},{"style":225},[5821],{"type":67,"value":5822}," text ",{"type":61,"tag":206,"props":5824,"children":5825},{"style":219},[5826],{"type":67,"value":383},{"type":61,"tag":206,"props":5828,"children":5829},{"style":219},[5830],{"type":67,"value":2555},{"type":61,"tag":206,"props":5832,"children":5833},{"style":213},[5834],{"type":67,"value":288},{"type":61,"tag":206,"props":5836,"children":5837},{"style":291},[5838],{"type":67,"value":228},{"type":61,"tag":206,"props":5840,"children":5841},{"style":225},[5842],{"type":67,"value":298},{"type":61,"tag":206,"props":5844,"children":5845},{"style":219},[5846],{"type":67,"value":303},{"type":61,"tag":206,"props":5848,"children":5849},{"class":208,"line":266},[5850,5854,5858,5862,5866,5870],{"type":61,"tag":206,"props":5851,"children":5852},{"style":310},[5853],{"type":67,"value":313},{"type":61,"tag":206,"props":5855,"children":5856},{"style":219},[5857],{"type":67,"value":318},{"type":61,"tag":206,"props":5859,"children":5860},{"style":219},[5861],{"type":67,"value":243},{"type":61,"tag":206,"props":5863,"children":5864},{"style":246},[5865],{"type":67,"value":327},{"type":61,"tag":206,"props":5867,"children":5868},{"style":219},[5869],{"type":67,"value":332},{"type":61,"tag":206,"props":5871,"children":5872},{"style":219},[5873],{"type":67,"value":374},{"type":61,"tag":206,"props":5875,"children":5876},{"class":208,"line":306},[5877,5881,5885,5889,5894,5898],{"type":61,"tag":206,"props":5878,"children":5879},{"style":310},[5880],{"type":67,"value":352},{"type":61,"tag":206,"props":5882,"children":5883},{"style":219},[5884],{"type":67,"value":318},{"type":61,"tag":206,"props":5886,"children":5887},{"style":219},[5888],{"type":67,"value":243},{"type":61,"tag":206,"props":5890,"children":5891},{"style":246},[5892],{"type":67,"value":5893},"Hello",{"type":61,"tag":206,"props":5895,"children":5896},{"style":219},[5897],{"type":67,"value":332},{"type":61,"tag":206,"props":5899,"children":5900},{"style":219},[5901],{"type":67,"value":374},{"type":61,"tag":206,"props":5903,"children":5904},{"class":208,"line":346},[5905,5909],{"type":61,"tag":206,"props":5906,"children":5907},{"style":219},[5908],{"type":67,"value":383},{"type":61,"tag":206,"props":5910,"children":5911},{"style":225},[5912],{"type":67,"value":388},{"type":61,"tag":206,"props":5914,"children":5915},{"class":208,"line":377},[5916],{"type":61,"tag":206,"props":5917,"children":5918},{"emptyLinePlaceholder":260},[5919],{"type":67,"value":263},{"type":61,"tag":206,"props":5921,"children":5922},{"class":208,"line":42},[5923],{"type":61,"tag":206,"props":5924,"children":5925},{"style":340},[5926],{"type":67,"value":5927},"\u002F\u002F Image — through gateway (multimodal LLMs return images in result.files)\n",{"type":61,"tag":206,"props":5929,"children":5930},{"class":208,"line":1382},[5931,5935,5939,5943,5947,5951,5955],{"type":61,"tag":206,"props":5932,"children":5933},{"style":270},[5934],{"type":67,"value":273},{"type":61,"tag":206,"props":5936,"children":5937},{"style":225},[5938],{"type":67,"value":278},{"type":61,"tag":206,"props":5940,"children":5941},{"style":219},[5942],{"type":67,"value":283},{"type":61,"tag":206,"props":5944,"children":5945},{"style":213},[5946],{"type":67,"value":288},{"type":61,"tag":206,"props":5948,"children":5949},{"style":291},[5950],{"type":67,"value":228},{"type":61,"tag":206,"props":5952,"children":5953},{"style":225},[5954],{"type":67,"value":298},{"type":61,"tag":206,"props":5956,"children":5957},{"style":219},[5958],{"type":67,"value":303},{"type":61,"tag":206,"props":5960,"children":5961},{"class":208,"line":1390},[5962,5966,5970,5974,5979,5983],{"type":61,"tag":206,"props":5963,"children":5964},{"style":310},[5965],{"type":67,"value":313},{"type":61,"tag":206,"props":5967,"children":5968},{"style":219},[5969],{"type":67,"value":318},{"type":61,"tag":206,"props":5971,"children":5972},{"style":219},[5973],{"type":67,"value":243},{"type":61,"tag":206,"props":5975,"children":5976},{"style":246},[5977],{"type":67,"value":5978},"google\u002Fgemini-3.1-flash-image-preview",{"type":61,"tag":206,"props":5980,"children":5981},{"style":219},[5982],{"type":67,"value":332},{"type":61,"tag":206,"props":5984,"children":5985},{"style":219},[5986],{"type":67,"value":374},{"type":61,"tag":206,"props":5988,"children":5989},{"class":208,"line":1399},[5990,5994,5998,6002,6007,6011],{"type":61,"tag":206,"props":5991,"children":5992},{"style":310},[5993],{"type":67,"value":352},{"type":61,"tag":206,"props":5995,"children":5996},{"style":219},[5997],{"type":67,"value":318},{"type":61,"tag":206,"props":5999,"children":6000},{"style":219},[6001],{"type":67,"value":243},{"type":61,"tag":206,"props":6003,"children":6004},{"style":246},[6005],{"type":67,"value":6006},"A sunset over the ocean",{"type":61,"tag":206,"props":6008,"children":6009},{"style":219},[6010],{"type":67,"value":332},{"type":61,"tag":206,"props":6012,"children":6013},{"style":219},[6014],{"type":67,"value":374},{"type":61,"tag":206,"props":6016,"children":6017},{"class":208,"line":1453},[6018,6022],{"type":61,"tag":206,"props":6019,"children":6020},{"style":219},[6021],{"type":67,"value":383},{"type":61,"tag":206,"props":6023,"children":6024},{"style":225},[6025],{"type":67,"value":388},{"type":61,"tag":206,"props":6027,"children":6028},{"class":208,"line":1461},[6029,6033,6038,6042,6046,6050,6055,6059,6064,6068,6072,6077,6081,6086,6091,6095,6100,6104,6109,6113,6117,6122,6126],{"type":61,"tag":206,"props":6030,"children":6031},{"style":270},[6032],{"type":67,"value":273},{"type":61,"tag":206,"props":6034,"children":6035},{"style":225},[6036],{"type":67,"value":6037}," images ",{"type":61,"tag":206,"props":6039,"children":6040},{"style":219},[6041],{"type":67,"value":283},{"type":61,"tag":206,"props":6043,"children":6044},{"style":225},[6045],{"type":67,"value":2550},{"type":61,"tag":206,"props":6047,"children":6048},{"style":219},[6049],{"type":67,"value":724},{"type":61,"tag":206,"props":6051,"children":6052},{"style":225},[6053],{"type":67,"value":6054},"files",{"type":61,"tag":206,"props":6056,"children":6057},{"style":219},[6058],{"type":67,"value":724},{"type":61,"tag":206,"props":6060,"children":6061},{"style":291},[6062],{"type":67,"value":6063},"filter",{"type":61,"tag":206,"props":6065,"children":6066},{"style":225},[6067],{"type":67,"value":298},{"type":61,"tag":206,"props":6069,"children":6070},{"style":219},[6071],{"type":67,"value":298},{"type":61,"tag":206,"props":6073,"children":6074},{"style":3367},[6075],{"type":67,"value":6076},"f",{"type":61,"tag":206,"props":6078,"children":6079},{"style":219},[6080],{"type":67,"value":533},{"type":61,"tag":206,"props":6082,"children":6083},{"style":270},[6084],{"type":67,"value":6085}," =>",{"type":61,"tag":206,"props":6087,"children":6088},{"style":225},[6089],{"type":67,"value":6090}," f",{"type":61,"tag":206,"props":6092,"children":6093},{"style":219},[6094],{"type":67,"value":724},{"type":61,"tag":206,"props":6096,"children":6097},{"style":225},[6098],{"type":67,"value":6099},"mediaType",{"type":61,"tag":206,"props":6101,"children":6102},{"style":219},[6103],{"type":67,"value":2826},{"type":61,"tag":206,"props":6105,"children":6106},{"style":291},[6107],{"type":67,"value":6108},"startsWith",{"type":61,"tag":206,"props":6110,"children":6111},{"style":225},[6112],{"type":67,"value":298},{"type":61,"tag":206,"props":6114,"children":6115},{"style":219},[6116],{"type":67,"value":332},{"type":61,"tag":206,"props":6118,"children":6119},{"style":246},[6120],{"type":67,"value":6121},"image\u002F",{"type":61,"tag":206,"props":6123,"children":6124},{"style":219},[6125],{"type":67,"value":332},{"type":61,"tag":206,"props":6127,"children":6128},{"style":225},[6129],{"type":67,"value":6130},"))\n",{"type":61,"tag":206,"props":6132,"children":6133},{"class":208,"line":1470},[6134],{"type":61,"tag":206,"props":6135,"children":6136},{"emptyLinePlaceholder":260},[6137],{"type":67,"value":263},{"type":61,"tag":206,"props":6139,"children":6140},{"class":208,"line":1524},[6141],{"type":61,"tag":206,"props":6142,"children":6143},{"style":340},[6144],{"type":67,"value":6145},"\u002F\u002F Image-only models — through gateway with experimental_generateImage\n",{"type":61,"tag":206,"props":6147,"children":6148},{"class":208,"line":1532},[6149,6153,6157,6162,6167,6172,6176,6180,6184,6188],{"type":61,"tag":206,"props":6150,"children":6151},{"style":213},[6152],{"type":67,"value":216},{"type":61,"tag":206,"props":6154,"children":6155},{"style":219},[6156],{"type":67,"value":222},{"type":61,"tag":206,"props":6158,"children":6159},{"style":225},[6160],{"type":67,"value":6161}," experimental_generateImage",{"type":61,"tag":206,"props":6163,"children":6164},{"style":213},[6165],{"type":67,"value":6166}," as",{"type":61,"tag":206,"props":6168,"children":6169},{"style":225},[6170],{"type":67,"value":6171}," generateImage",{"type":61,"tag":206,"props":6173,"children":6174},{"style":219},[6175],{"type":67,"value":233},{"type":61,"tag":206,"props":6177,"children":6178},{"style":213},[6179],{"type":67,"value":238},{"type":61,"tag":206,"props":6181,"children":6182},{"style":219},[6183],{"type":67,"value":243},{"type":61,"tag":206,"props":6185,"children":6186},{"style":246},[6187],{"type":67,"value":49},{"type":61,"tag":206,"props":6189,"children":6190},{"style":219},[6191],{"type":67,"value":253},{"type":61,"tag":206,"props":6193,"children":6194},{"class":208,"line":1541},[6195,6199,6203,6208,6212,6217,6221,6225,6229,6233,6237],{"type":61,"tag":206,"props":6196,"children":6197},{"style":270},[6198],{"type":67,"value":273},{"type":61,"tag":206,"props":6200,"children":6201},{"style":219},[6202],{"type":67,"value":222},{"type":61,"tag":206,"props":6204,"children":6205},{"style":310},[6206],{"type":67,"value":6207}," images",{"type":61,"tag":206,"props":6209,"children":6210},{"style":219},[6211],{"type":67,"value":318},{"type":61,"tag":206,"props":6213,"children":6214},{"style":225},[6215],{"type":67,"value":6216}," generated ",{"type":61,"tag":206,"props":6218,"children":6219},{"style":219},[6220],{"type":67,"value":383},{"type":61,"tag":206,"props":6222,"children":6223},{"style":219},[6224],{"type":67,"value":2555},{"type":61,"tag":206,"props":6226,"children":6227},{"style":213},[6228],{"type":67,"value":288},{"type":61,"tag":206,"props":6230,"children":6231},{"style":291},[6232],{"type":67,"value":6171},{"type":61,"tag":206,"props":6234,"children":6235},{"style":225},[6236],{"type":67,"value":298},{"type":61,"tag":206,"props":6238,"children":6239},{"style":219},[6240],{"type":67,"value":303},{"type":61,"tag":206,"props":6242,"children":6243},{"class":208,"line":1571},[6244,6248,6252,6256,6261,6265],{"type":61,"tag":206,"props":6245,"children":6246},{"style":310},[6247],{"type":67,"value":313},{"type":61,"tag":206,"props":6249,"children":6250},{"style":219},[6251],{"type":67,"value":318},{"type":61,"tag":206,"props":6253,"children":6254},{"style":219},[6255],{"type":67,"value":243},{"type":61,"tag":206,"props":6257,"children":6258},{"style":246},[6259],{"type":67,"value":6260},"google\u002Fimagen-4.0-generate-001",{"type":61,"tag":206,"props":6262,"children":6263},{"style":219},[6264],{"type":67,"value":332},{"type":61,"tag":206,"props":6266,"children":6267},{"style":219},[6268],{"type":67,"value":374},{"type":61,"tag":206,"props":6270,"children":6271},{"class":208,"line":1579},[6272,6276,6280,6284,6289,6293],{"type":61,"tag":206,"props":6273,"children":6274},{"style":310},[6275],{"type":67,"value":352},{"type":61,"tag":206,"props":6277,"children":6278},{"style":219},[6279],{"type":67,"value":318},{"type":61,"tag":206,"props":6281,"children":6282},{"style":219},[6283],{"type":67,"value":243},{"type":61,"tag":206,"props":6285,"children":6286},{"style":246},[6287],{"type":67,"value":6288},"A sunset",{"type":61,"tag":206,"props":6290,"children":6291},{"style":219},[6292],{"type":67,"value":332},{"type":61,"tag":206,"props":6294,"children":6295},{"style":219},[6296],{"type":67,"value":374},{"type":61,"tag":206,"props":6298,"children":6299},{"class":208,"line":1588},[6300,6304],{"type":61,"tag":206,"props":6301,"children":6302},{"style":219},[6303],{"type":67,"value":383},{"type":61,"tag":206,"props":6305,"children":6306},{"style":225},[6307],{"type":67,"value":388},{"type":61,"tag":74,"props":6309,"children":6310},{},[6311,6316,6318,6323],{"type":61,"tag":78,"props":6312,"children":6313},{},[6314],{"type":67,"value":6315},"Default image model",{"type":67,"value":6317},": ",{"type":61,"tag":141,"props":6319,"children":6321},{"className":6320},[],[6322],{"type":67,"value":5978},{"type":67,"value":6324}," — fast multimodal image generation via gateway.",{"type":61,"tag":74,"props":6326,"children":6327},{},[6328,6330,6337],{"type":67,"value":6329},"See ",{"type":61,"tag":93,"props":6331,"children":6334},{"href":6332,"rel":6333},"https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway\u002Fcapabilities\u002Fimage-generation",[96],[6335],{"type":67,"value":6336},"AI Gateway Image Generation docs",{"type":67,"value":6338}," for all supported models and integration methods.",{"type":61,"tag":115,"props":6340,"children":6342},{"id":6341},"key-benefits",[6343],{"type":67,"value":6344},"Key Benefits",{"type":61,"tag":925,"props":6346,"children":6347},{},[6348,6358,6368,6378,6388,6398],{"type":61,"tag":137,"props":6349,"children":6350},{},[6351,6356],{"type":61,"tag":78,"props":6352,"children":6353},{},[6354],{"type":67,"value":6355},"Unified API",{"type":67,"value":6357},": One interface for all providers, no provider-specific code",{"type":61,"tag":137,"props":6359,"children":6360},{},[6361,6366],{"type":61,"tag":78,"props":6362,"children":6363},{},[6364],{"type":67,"value":6365},"Automatic failover",{"type":67,"value":6367},": If a provider is down, requests route to the next",{"type":61,"tag":137,"props":6369,"children":6370},{},[6371,6376],{"type":61,"tag":78,"props":6372,"children":6373},{},[6374],{"type":67,"value":6375},"Cost tracking",{"type":67,"value":6377},": Per-user, per-feature attribution with tags",{"type":61,"tag":137,"props":6379,"children":6380},{},[6381,6386],{"type":61,"tag":78,"props":6382,"children":6383},{},[6384],{"type":67,"value":6385},"Observability",{"type":67,"value":6387},": Built-in monitoring of all model calls",{"type":61,"tag":137,"props":6389,"children":6390},{},[6391,6396],{"type":61,"tag":78,"props":6392,"children":6393},{},[6394],{"type":67,"value":6395},"Low latency",{"type":67,"value":6397},": \u003C20ms routing overhead",{"type":61,"tag":137,"props":6399,"children":6400},{},[6401,6406],{"type":61,"tag":78,"props":6402,"children":6403},{},[6404],{"type":67,"value":6405},"No lock-in",{"type":67,"value":6407},": Switch models\u002Fproviders by changing a string",{"type":61,"tag":115,"props":6409,"children":6411},{"id":6410},"when-to-use-ai-gateway",[6412],{"type":67,"value":6413},"When to Use AI Gateway",{"type":61,"tag":1695,"props":6415,"children":6416},{},[6417,6433],{"type":61,"tag":1699,"props":6418,"children":6419},{},[6420],{"type":61,"tag":1703,"props":6421,"children":6422},{},[6423,6428],{"type":61,"tag":1707,"props":6424,"children":6425},{},[6426],{"type":67,"value":6427},"Scenario",{"type":61,"tag":1707,"props":6429,"children":6430},{},[6431],{"type":67,"value":6432},"Use Gateway?",{"type":61,"tag":1718,"props":6434,"children":6435},{},[6436,6449,6462,6475,6488,6501,6514],{"type":61,"tag":1703,"props":6437,"children":6438},{},[6439,6444],{"type":61,"tag":1725,"props":6440,"children":6441},{},[6442],{"type":67,"value":6443},"Production app with AI features",{"type":61,"tag":1725,"props":6445,"children":6446},{},[6447],{"type":67,"value":6448},"Yes — failover, cost tracking",{"type":61,"tag":1703,"props":6450,"children":6451},{},[6452,6457],{"type":61,"tag":1725,"props":6453,"children":6454},{},[6455],{"type":67,"value":6456},"Prototyping with single provider",{"type":61,"tag":1725,"props":6458,"children":6459},{},[6460],{"type":67,"value":6461},"Optional — direct provider works fine",{"type":61,"tag":1703,"props":6463,"children":6464},{},[6465,6470],{"type":61,"tag":1725,"props":6466,"children":6467},{},[6468],{"type":67,"value":6469},"Multi-provider setup",{"type":61,"tag":1725,"props":6471,"children":6472},{},[6473],{"type":67,"value":6474},"Yes — unified routing",{"type":61,"tag":1703,"props":6476,"children":6477},{},[6478,6483],{"type":61,"tag":1725,"props":6479,"children":6480},{},[6481],{"type":67,"value":6482},"Need provider-specific features",{"type":61,"tag":1725,"props":6484,"children":6485},{},[6486],{"type":67,"value":6487},"Use direct provider SDK + Gateway as fallback",{"type":61,"tag":1703,"props":6489,"children":6490},{},[6491,6496],{"type":61,"tag":1725,"props":6492,"children":6493},{},[6494],{"type":67,"value":6495},"Cost tracking and budgeting",{"type":61,"tag":1725,"props":6497,"children":6498},{},[6499],{"type":67,"value":6500},"Yes — user tracking and tags",{"type":61,"tag":1703,"props":6502,"children":6503},{},[6504,6509],{"type":61,"tag":1725,"props":6505,"children":6506},{},[6507],{"type":67,"value":6508},"Multi-tenant SaaS",{"type":61,"tag":1725,"props":6510,"children":6511},{},[6512],{"type":67,"value":6513},"Yes — per-user rate limiting and audit",{"type":61,"tag":1703,"props":6515,"children":6516},{},[6517,6522],{"type":61,"tag":1725,"props":6518,"children":6519},{},[6520],{"type":67,"value":6521},"Compliance requirements",{"type":61,"tag":1725,"props":6523,"children":6524},{},[6525],{"type":67,"value":6526},"Yes — audit logging and log drains",{"type":61,"tag":115,"props":6528,"children":6530},{"id":6529},"official-documentation",[6531],{"type":67,"value":6532},"Official Documentation",{"type":61,"tag":133,"props":6534,"children":6535},{},[6536,6544,6553,6563],{"type":61,"tag":137,"props":6537,"children":6538},{},[6539],{"type":61,"tag":93,"props":6540,"children":6542},{"href":44,"rel":6541},[96],[6543],{"type":67,"value":2416},{"type":61,"tag":137,"props":6545,"children":6546},{},[6547],{"type":61,"tag":93,"props":6548,"children":6550},{"href":103,"rel":6549},[96],[6551],{"type":67,"value":6552},"Providers and Models",{"type":61,"tag":137,"props":6554,"children":6555},{},[6556],{"type":61,"tag":93,"props":6557,"children":6560},{"href":6558,"rel":6559},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core",[96],[6561],{"type":67,"value":6562},"AI SDK Core",{"type":61,"tag":137,"props":6564,"children":6565},{},[6566],{"type":61,"tag":93,"props":6567,"children":6570},{"href":6568,"rel":6569},"https:\u002F\u002Fgithub.com\u002Fvercel\u002Fai",[96],[6571],{"type":67,"value":6572},"GitHub: AI SDK",{"type":61,"tag":6574,"props":6575,"children":6576},"style",{},[6577],{"type":67,"value":6578},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":6580,"total":6686},[6581,6600,6616,6626,6646,6666,6674],{"slug":6582,"name":6582,"fn":6583,"description":6584,"org":6585,"tags":6586,"stars":28,"repoUrl":29,"updatedAt":6599},"accessibility-and-inclusive-visualization","make data visualizations accessible","Make data visualizations accessible and inclusive. Use when the user needs chart or diagram accessibility guidance, text alternatives for complex visuals, color and contrast review, keyboard support, reduced-motion behavior for animation or parallax, or an accessibility QA workflow for exported figures, UML-like diagrams, and dashboards.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6587,6590,6593,6596],{"name":6588,"slug":6589,"type":15},"Accessibility","accessibility",{"name":6591,"slug":6592,"type":15},"Charts","charts",{"name":6594,"slug":6595,"type":15},"Data Visualization","data-visualization",{"name":6597,"slug":6598,"type":15},"Design","design","2026-06-30T19:00:57.102",{"slug":6601,"name":6601,"fn":6602,"description":6603,"org":6604,"tags":6605,"stars":28,"repoUrl":29,"updatedAt":6615},"agent-browser","automate browser interactions for agents","Browser automation CLI for AI agents. Use when the user needs to interact with websites, verify dev server output, test web apps, navigate pages, fill forms, click buttons, take screenshots, extract data, or automate any browser task. Also triggers when a dev server starts so you can verify it visually.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6606,6609,6612],{"name":6607,"slug":6608,"type":15},"Agents","agents",{"name":6610,"slug":6611,"type":15},"Browser Automation","browser-automation",{"name":6613,"slug":6614,"type":15},"Testing","testing","2026-04-06T18:41:03.44016",{"slug":6617,"name":6617,"fn":6618,"description":6619,"org":6620,"tags":6621,"stars":28,"repoUrl":29,"updatedAt":6625},"agent-browser-verify","verify dev server output with automated browser","Automated browser verification for dev servers. Triggers when a dev server starts to run a visual gut-check with agent-browser — verifies the page loads, checks for console errors, validates key UI elements, and reports pass\u002Ffail before continuing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6622,6623,6624],{"name":6610,"slug":6611,"type":15},{"name":1012,"slug":1009,"type":15},{"name":6613,"slug":6614,"type":15},"2026-04-06T18:41:17.526867",{"slug":6627,"name":6627,"fn":6628,"description":6629,"org":6630,"tags":6631,"stars":28,"repoUrl":29,"updatedAt":6645},"agents-sdk","build AI agents on Cloudflare Workers","Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6632,6633,6636,6639,6642],{"name":6607,"slug":6608,"type":15},{"name":6634,"slug":6635,"type":15},"Cloudflare Workers","cloudflare-workers",{"name":6637,"slug":6638,"type":15},"SDK","sdk",{"name":6640,"slug":6641,"type":15},"Serverless","serverless",{"name":6643,"slug":6644,"type":15},"WebSockets","websockets","2026-04-06T18:39:51.717063",{"slug":6647,"name":6647,"fn":6648,"description":6649,"org":6650,"tags":6651,"stars":28,"repoUrl":29,"updatedAt":6665},"ai-elements","build chat UIs with AI Elements","AI Elements component library guidance — pre-built React components for AI interfaces built on shadcn\u002Fui. Use when building chat UIs, message displays, tool call rendering, streaming responses, reasoning panels, or any AI-native interface with the AI SDK.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6652,6655,6658,6661,6664],{"name":6653,"slug":6654,"type":15},"Frontend","frontend",{"name":6656,"slug":6657,"type":15},"React","react",{"name":6659,"slug":6660,"type":15},"shadcn\u002Fui","shadcn-ui",{"name":6662,"slug":6663,"type":15},"UI Components","ui-components",{"name":17,"slug":18,"type":15},"2026-04-06T18:40:59.619419",{"slug":4,"name":4,"fn":5,"description":6,"org":6667,"tags":6668,"stars":28,"repoUrl":29,"updatedAt":30},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6669,6670,6671,6672,6673],{"name":26,"slug":27,"type":15},{"name":23,"slug":24,"type":15},{"name":20,"slug":21,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"slug":6675,"name":6675,"fn":6676,"description":6677,"org":6678,"tags":6679,"stars":28,"repoUrl":29,"updatedAt":6685},"ai-generation-persistence","implement persistence patterns for AI generations","AI generation persistence patterns — unique IDs, addressable URLs, database storage, and cost tracking for every LLM generation",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6680,6681,6684],{"name":23,"slug":24,"type":15},{"name":6682,"slug":6683,"type":15},"Database","database",{"name":20,"slug":21,"type":15},"2026-04-06T18:41:08.513425",600,{"items":6688,"total":6885},[6689,6710,6733,6750,6766,6783,6802,6814,6828,6842,6854,6869],{"slug":6690,"name":6690,"fn":6691,"description":6692,"org":6693,"tags":6694,"stars":6707,"repoUrl":6708,"updatedAt":6709},"prior-auth-packet-builder","build healthcare prior authorization packets","Build a concise prior authorization packet from local case files and payer policy docs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6695,6698,6701,6704],{"name":6696,"slug":6697,"type":15},"Documents","documents",{"name":6699,"slug":6700,"type":15},"Healthcare","healthcare",{"name":6702,"slug":6703,"type":15},"Insurance","insurance",{"name":6705,"slug":6706,"type":15},"Regulatory Compliance","regulatory-compliance",28169,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python","2026-04-16T05:11:39.180399",{"slug":6711,"name":6711,"fn":6712,"description":6713,"org":6714,"tags":6715,"stars":6730,"repoUrl":6731,"updatedAt":6732},"aspnet-core","build ASP.NET Core web applications","Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development. Use when working on Blazor Web Apps, Razor Pages, MVC, Minimal APIs, controller-based Web APIs, SignalR, gRPC, middleware, dependency injection, configuration, authentication, authorization, testing, performance, deployment, or ASP.NET Core upgrades.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6716,6719,6721,6724,6727],{"name":6717,"slug":6718,"type":15},".NET","dotnet",{"name":6720,"slug":6711,"type":15},"ASP.NET Core",{"name":6722,"slug":6723,"type":15},"Blazor","blazor",{"name":6725,"slug":6726,"type":15},"C#","csharp",{"name":6728,"slug":6729,"type":15},"Web Development","web-development",23787,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fskills","2026-04-12T05:07:02.819491",{"slug":6734,"name":6734,"fn":6735,"description":6736,"org":6737,"tags":6738,"stars":6730,"repoUrl":6731,"updatedAt":6749},"chatgpt-apps","build ChatGPT Apps SDK applications","Build, scaffold, refactor, and troubleshoot ChatGPT Apps SDK applications that combine an MCP server and widget UI. Use when Codex needs to design tools, register UI resources, wire the MCP Apps bridge or ChatGPT compatibility APIs, apply Apps SDK metadata or CSP or domain settings, or produce a docs-aligned project scaffold. Prefer a docs-first workflow by invoking the openai-docs skill or OpenAI developer docs MCP tools before generating code.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6739,6742,6745,6748],{"name":6740,"slug":6741,"type":15},"Apps SDK","apps-sdk",{"name":6743,"slug":6744,"type":15},"ChatGPT","chatgpt",{"name":6746,"slug":6747,"type":15},"MCP","mcp",{"name":9,"slug":8,"type":15},"2026-04-12T05:07:05.468097",{"slug":6751,"name":6751,"fn":6752,"description":6753,"org":6754,"tags":6755,"stars":6730,"repoUrl":6731,"updatedAt":6765},"cli-creator","build CLIs from API docs","Build a composable CLI for Codex from API docs, an OpenAPI spec, existing curl examples, an SDK, a web app, an admin tool, or a local script. Use when the user wants Codex to create a command-line tool that can run from any repo, expose composable read\u002Fwrite commands, return stable JSON, manage auth, and pair with a companion skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6756,6759,6762],{"name":6757,"slug":6758,"type":15},"API Development","api-development",{"name":6760,"slug":6761,"type":15},"CLI","cli",{"name":6763,"slug":6764,"type":15},"Codex","codex","2026-04-12T05:07:04.132762",{"slug":6767,"name":6767,"fn":6768,"description":6769,"org":6770,"tags":6771,"stars":6730,"repoUrl":6731,"updatedAt":6782},"cloudflare-deploy","deploy projects to Cloudflare","Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6772,6775,6778,6779],{"name":6773,"slug":6774,"type":15},"Cloudflare","cloudflare",{"name":6776,"slug":6777,"type":15},"Cloudflare Pages","cloudflare-pages",{"name":6634,"slug":6635,"type":15},{"name":6780,"slug":6781,"type":15},"Deployment","deployment","2026-04-12T05:07:14.275118",{"slug":6784,"name":6784,"fn":6785,"description":6786,"org":6787,"tags":6788,"stars":6730,"repoUrl":6731,"updatedAt":6801},"define-goal","define and set measurable project goals","Help the user define a concrete, measurable goal before starting work, especially when they ask to use the goal tool, create a goal, set an objective, clarify success criteria, or turn a fuzzy intention into a quantitative outcome. Use this skill for goal creation and goal refinement only; it does not manage durable snapshots, decision logs, or long-running execution artifacts.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6789,6792,6795,6798],{"name":6790,"slug":6791,"type":15},"Productivity","productivity",{"name":6793,"slug":6794,"type":15},"Project Management","project-management",{"name":6796,"slug":6797,"type":15},"Strategy","strategy",{"name":6799,"slug":6800,"type":15},"Task Management","task-management","2026-05-23T06:17:16.870838",{"slug":6803,"name":6803,"fn":6804,"description":6805,"org":6806,"tags":6807,"stars":6730,"repoUrl":6731,"updatedAt":6813},"figma","translate Figma designs into code","Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6808,6809,6811,6812],{"name":6597,"slug":6598,"type":15},{"name":6810,"slug":6803,"type":15},"Figma",{"name":6653,"slug":6654,"type":15},{"name":6746,"slug":6747,"type":15},"2026-04-12T05:06:47.939943",{"slug":6815,"name":6815,"fn":6816,"description":6817,"org":6818,"tags":6819,"stars":6730,"repoUrl":6731,"updatedAt":6827},"figma-code-connect-components","connect Figma designs to code components","Connects Figma design components to code components using Code Connect mapping tools. Use when user says \"code connect\", \"connect this component to code\", \"map this component\", \"link component to code\", \"create code connect mapping\", or wants to establish mappings between Figma designs and code implementations. For canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6820,6821,6824,6825,6826],{"name":6597,"slug":6598,"type":15},{"name":6822,"slug":6823,"type":15},"Design System","design-system",{"name":6810,"slug":6803,"type":15},{"name":6653,"slug":6654,"type":15},{"name":6662,"slug":6663,"type":15},"2026-05-10T05:59:52.971881",{"slug":6829,"name":6829,"fn":6830,"description":6831,"org":6832,"tags":6833,"stars":6730,"repoUrl":6731,"updatedAt":6841},"figma-create-design-system-rules","generate design system rules from Figma","Generates custom design system rules for the user's codebase. Use when user says \"create design system rules\", \"generate rules for my project\", \"set up design rules\", \"customize design system guidelines\", or wants to establish project-specific conventions for Figma-to-code workflows. Requires Figma MCP server connection.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6834,6835,6836,6839,6840],{"name":6597,"slug":6598,"type":15},{"name":6822,"slug":6823,"type":15},{"name":6837,"slug":6838,"type":15},"Documentation","documentation",{"name":6810,"slug":6803,"type":15},{"name":6653,"slug":6654,"type":15},"2026-05-16T06:07:47.821474",{"slug":6843,"name":6843,"fn":6844,"description":6845,"org":6846,"tags":6847,"stars":6730,"repoUrl":6731,"updatedAt":6853},"figma-implement-design","translate Figma designs into application code","Translates Figma designs into production-ready application code with 1:1 visual fidelity. Use when implementing UI code from Figma files, when user mentions \"implement design\", \"generate code\", \"implement component\", provides Figma URLs, or asks to build components matching Figma specs. For Figma canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6848,6849,6850,6851,6852],{"name":6597,"slug":6598,"type":15},{"name":6810,"slug":6803,"type":15},{"name":6653,"slug":6654,"type":15},{"name":6662,"slug":6663,"type":15},{"name":6728,"slug":6729,"type":15},"2026-05-16T06:07:40.583615",{"slug":6855,"name":6855,"fn":6856,"description":6857,"org":6858,"tags":6859,"stars":6730,"repoUrl":6731,"updatedAt":6868},"hatch-pet","create animated pets for Codex","Create, repair, validate, visually QA, and package Codex-compatible animated pets and pet spritesheets from character art, generated images, company or prospect brand cues, or visual references. Use when a user wants a lightweight-worker Codex pet workflow, a non-pixel custom pet style, a prospect or company mascot pet, or a full 8x9 animated pet atlas with transparent unused cells, QA contact sheets, and pet.json packaging. This skill composes the installed $imagegen system skill for visual generation and uses bundled scripts for deterministic spritesheet assembly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6860,6863,6864,6867],{"name":6861,"slug":6862,"type":15},"Animation","animation",{"name":6763,"slug":6764,"type":15},{"name":6865,"slug":6866,"type":15},"Creative","creative",{"name":6597,"slug":6598,"type":15},"2026-05-02T05:31:48.48485",{"slug":6870,"name":6870,"fn":6871,"description":6872,"org":6873,"tags":6874,"stars":6730,"repoUrl":6731,"updatedAt":6884},"imagegen","generate and edit raster images","Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG\u002Fvector\u002Fcode-native assets, extending an established icon or logo system, or building the visual directly in HTML\u002FCSS\u002Fcanvas.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6875,6876,6877,6880,6883],{"name":6865,"slug":6866,"type":15},{"name":6597,"slug":6598,"type":15},{"name":6878,"slug":6879,"type":15},"Image Generation","image-generation",{"name":6881,"slug":6882,"type":15},"Images","images",{"name":9,"slug":8,"type":15},"2026-05-15T06:23:24.312127",675]