ai-sdk

Guides building AI features with the Vercel AI SDK using version-matched bundled documentation.

Updated Aug 26, 2026
One-click install
npx skills add https://github.com/MohamadJoumaa/Direct --skill ai-sdk-mohamadjoumaa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/MohamadJoumaa/Direct/tree/main/.cursor/skills/ai-sdk
Command: npx skills add https://github.com/MohamadJoumaa/Direct --skill ai-sdk-mohamadjoumaa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai.

What problem does it solve? AI SDK APIs change frequently across versions, so code written from memory often uses renamed, removed, or deprecated functions. This Skill prevents those errors by directing the AI to verify every API against the documentation bundled inside the installed ai package. ## Core Features & Use Cases - Version-Matched Guidance: Reads docs and source from node_modules/ai/docs/ and node_modules/ai/src/ so answers always match the installed version. - Agent and App Building: Helps build agents with ToolLoopAgent, chatbots with useChat, RAG systems, structured output, tool calling, and embeddings. - AI Gateway Setup: Configures the Vercel AI Gateway for multi-provider model access and fetches the current model list instead of relying on memorized model IDs. - Use Case: A developer asks to add a streaming chatbot to a Next.js app. The Skill checks the installed ai version, reads the bundled useChat docs, and generates code that compiles against the actual API. ## Quick Start Ask the AI to build a streaming chat endpoint with the AI SDK and have it verify the API against the bundled docs in node_modules before writing code.

Frequently Asked Questions about ai-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an agent with the Vercel AI SDK?

Use the SDK's built-in agent abstraction such as ToolLoopAgent instead of hand-rolling tool-calling loops. Check the agents section of the bundled docs at node_modules/ai/docs/ for the current API, since agent interfaces change between versions.

How do I use useChat in a React app with the AI SDK?

The useChat hook is among the most frequently changed APIs, so never write it from memory. Read the bundled docs in node_modules/@ai-sdk/react/docs/ for your installed version and infer the UI message type from your agent definition for type safety.

What is the Vercel AI Gateway and how do I set it up?

The AI Gateway provides access to models from OpenAI, Anthropic, Google, and others through a single API without installing provider packages. Authenticate via OIDC or an API key set as AI_GATEWAY_API_KEY, then reference models with provider/model strings.

Why does my AI SDK code fail with type errors after upgrading?

Most type errors come from APIs that were renamed or removed between versions. Compare your installed version in node_modules/ai/package.json against npm view ai version, then consult the migration guides at ai-sdk.dev/docs/migration-guides.

How do I find which AI models are currently available?

Fetch the live model list from https://ai-gateway.vercel.sh/v1/models instead of using memorized model IDs, since models are released and retired frequently. When multiple versions exist, prefer the one with the highest version number.