Vercel AI SDK 6.0

Last reviewed Sep 6, 2026

Export as PDF

Prompt Details

Prompt Composition

4prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. TypeScript 746 lines · 1.5K tokens
  4. Vercel AI SDK 6.089 lines · 4K tokens
Total338 lines · 13.9K tokens

CWE Coverage

  • 15
  • 20
  • 22
  • 59
  • 73
  • 78
  • 79
  • 88
  • 89
  • 95
  • 113
  • 117
  • 200
  • 201
  • 208
  • 209
  • 214
  • 250
  • 295
  • 297
  • 306
  • 319
  • 323
  • 330
  • 338
  • 346
  • 347
  • 352
  • 354
  • 362
  • 367
  • 377
  • 426
  • 444
  • 459
  • 471
  • 488
  • 494
  • 502
  • 522
  • 524
  • 532
  • 602
  • 639
  • 653
  • 732
  • 770
  • 772
  • 807
  • 829
  • 838
  • 841
  • 862
  • 863
  • 908
  • 915
  • 916
  • 918
  • 922
  • 942
  • 943
  • 1004
  • 1321
  • 1333
  • 1426
  • 1427

Prompt Preview

Apply the Node.js 24 and TypeScript 7 prompts first. These rules cover Vercel AI SDK 6.0 provider configuration, prompts, tools and approvals, agent loops, structured output, streaming, persistence, MCP, and observability.

Providers, models, and call budgets

  • Build model IDs, provider instances, API keys, base URLs, and request headers from server configuration rather than from a request body or a useChat transport option.
  • Keep provider and gateway credentials out of client bundles, DefaultChatTransport headers, and any body or headers callback that runs in the browser.
  • Allowlist the model IDs, modalities, and providerOptions a caller may select instead of spreading a caller-supplied settings object into generateText or streamText.
  • Set maxOutputTokens on every call; 6.0 sends no output ceiling of its own when the setting is omitted.
  • Bound each call with timeout using totalMs and stepMs alongside abortSignal, because maxRetries defaults to 2 and one request can reach the provider three times.
  • Treat an abort or a browser disconnect as local cancellation only, and reconcile provider-side spend and partially completed side effects separately.

Prompts, messages, and validation

  • Keep system and agent instructions text in server code, never let a UIMessage part supply, append to, or replace it, and set allowSystemInMessages: false on streamText, generateText, and ToolLoopAgent: validateUIMessages accepts a client-sent role: 'system' message, convertToModelMessages turns it into a real system message, and with