ai-sdk

Build AI agents, chatbots, and text generation features with the Vercel AI SDK.

3|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/langgenius/due-date-hq-jwl --skill ai-sdk-langgenius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/langgenius/due-date-hq-jwl/tree/main/.agents/skills/ai-sdk
Command: npx skills add https://github.com/langgenius/due-date-hq-jwl --skill ai-sdk-langgenius

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai.

What problem does it solve? Developers frequently write AI SDK code from outdated memory, producing errors because APIs like useChat, generateText, and streamText change across versions. This Skill enforces verification against version-matched bundled documentation so generated code matches the installed SDK. ## Core Features & Use Cases - Version-Matched Documentation Lookup: Reads bundled docs and source in node_modules/ai/docs and node_modules/ai/src so answers always match the installed package version. - Agent and App Building Guidance: Helps build agents with ToolLoopAgent, chatbots with useChat, RAG systems, structured output, tool calling, and embeddings across providers like OpenAI, Anthropic, and Google. - AI Gateway Setup and Model Selection: Configures the Vercel AI Gateway with AI_GATEWAY_API_KEY and fetches the live model list instead of relying on memorized model IDs. - Use Case: A developer asks to add a streaming chat endpoint to a Next.js app. The Skill checks the installed ai package version, reads its bundled docs, and writes code using the current streamText and useChat APIs. ## Quick Start Ask the assistant to build a streaming chatbot using the AI SDK and have it verify every API against the bundled documentation 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 AI agent with the Vercel AI SDK?

Use the SDK's built-in agent abstraction such as ToolLoopAgent rather than hand-rolling tool-calling loops. Check the agents section of the bundled docs in node_modules/ai/docs for the current API, then infer the UI message type from your agent when consuming it with useChat.

How do I use generateText and streamText with the AI SDK?

Look up the current signatures in the bundled documentation at node_modules/ai/docs or node_modules/ai/src, since these APIs change across versions. Never write calls from memory; verify options and defaults against the installed version.

Does the AI SDK support OpenAI, Anthropic, and Google models?

Yes, the AI SDK provides a unified API across providers including OpenAI, Anthropic, and Google. The Vercel AI Gateway gives access to all of them through a single API key via the AI_GATEWAY_API_KEY environment variable, using provider/model string identifiers.

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, especially UI hooks like useChat. 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 current model IDs for the AI SDK?

Fetch the live model list from the AI Gateway with curl https://ai-gateway.vercel.sh/v1/models instead of using memorized IDs. Models are released and retired frequently, so prefer the highest version number when multiple variants exist.