Vercel AI SDK 7.0

Last reviewed Oct 28, 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 7.056 lines · 1.5K tokens
Total305 lines · 11.4K 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
  • 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 7.0 providers, generation, streaming, tools, structured output, UI messages, persistence, retrieval, and operations.

Providers and configuration

  • Construct provider instances, model IDs, credentials, base URLs, headers, and provider options from trusted server configuration.
  • Keep provider keys out of client components, browser hooks, public environment variables, UI messages, and stream data parts.
  • Allowlist model IDs, provider options, modalities, and output limits instead of accepting a caller-built settings object.
  • Set maxRetries explicitly when the SDK default of 2 is unsuitable and count every retry against per-principal spend.
  • Pass timeout as totalMs/stepMs plus an abort signal; neither cancellation nor a UI disconnect proves provider-side work stopped.

Generation and instruction boundaries

  • Keep system instructions in server code and convert user UI messages into model messages only after validating allowed roles and parts.
  • Call validateUIMessages with the expected schemas, but treat it as structural validation only; it performs no user or resource authorization.
  • Bound message/history count, attachments, data parts, media bytes, input, output, and reasoning budget before generateText or streamText.
  • Apply the baseline URL policy to attachment and tool-result URLs before model conversion; experimental_download can fetch them or forward them to the provider, and custom downloads need their own deadline and byte limits.
  • Inspect finish reason