Vercel AI SDK 6.0
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 746 lines · 1.5K tokens
- 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
headersfrom server configuration rather than from a request body or auseChattransport option. - Keep provider and gateway credentials out of client bundles,
DefaultChatTransportheaders, and anybodyorheaderscallback that runs in the browser. - Allowlist the model IDs, modalities, and
providerOptionsa caller may select instead of spreading a caller-supplied settings object intogenerateTextorstreamText. - Set
maxOutputTokenson every call; 6.0 sends no output ceiling of its own when the setting is omitted. - Bound each call with
timeoutusingtotalMsandstepMsalongsideabortSignal, becausemaxRetriesdefaults 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
systemand agentinstructionstext in server code, never let aUIMessagepart supply, append to, or replace it, and setallowSystemInMessages: falseonstreamText,generateText, andToolLoopAgent:validateUIMessagesaccepts a client-sentrole: 'system'message,convertToModelMessagesturns it into a real system message, and with