ai-sdk

Answers questions and builds AI features using the Vercel AI SDK TypeScript toolkit.

Updated Sep 5, 2023
One-click install
npx skills add https://github.com/eyenalxai/dotfiles --skill ai-sdk-eyenalxai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/eyenalxai/dotfiles/tree/main/.agents/skills/ai-sdk
Command: npx skills add https://github.com/eyenalxai/dotfiles --skill ai-sdk-eyenalxai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building AI features with the Vercel AI SDK often rely on outdated knowledge of rapidly changing APIs, leading to broken code with renamed functions, deprecated patterns, and retired model IDs. This Skill grounds every answer in the version-matched documentation bundled inside node_modules. ## Core Features & Use Cases - Version-Accurate Guidance: Reads the bundled docs and source at node_modules/ai/docs/ and node_modules/ai/src/ so answers always match the installed SDK version. - AI Feature Development: Helps build agents with ToolLoopAgent, chatbots with useChat, RAG systems, tool calling, structured output, and embeddings across providers like OpenAI, Anthropic, and Google. - AI Gateway Setup: Configures the Vercel AI Gateway for unified multi-provider access and fetches the current model list instead of relying on memorized model IDs. - Use Case: You ask how to add streaming chat to your Next.js app. The Skill checks your installed ai package version, reads its bundled docs, and writes code using the current useChat API rather than an outdated pattern. ## Quick Start Ask how to build a streaming chatbot with the AI SDK in your project and let it verify the installed version's docs first.

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 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 generateText and streamText in the AI SDK?

generateText and streamText are core AI SDK functions for text generation, but their options change across versions. Read the bundled documentation in node_modules/ai/docs/ for your installed version rather than relying on memorized signatures.

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 through provider packages like @ai-sdk/openai. The Vercel AI Gateway offers access to all of them through a single API key without installing separate provider packages.

Why is my useChat code not working after upgrading the AI SDK?

UI hooks like useChat are among the most frequently changed APIs in the AI SDK, so code written for older versions often breaks. Compare your installed version against the latest with npm view ai version and follow 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 -s https://ai-gateway.vercel.sh/v1/models instead of using memorized model IDs. Models are released and retired frequently, so prefer the highest version number when multiple variants exist.