ai-sdk

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

Updated Dec 17, 2022
One-click install
npx skills add https://github.com/Foodshareclub/foodshare-web --skill ai-sdk-foodshareclub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/Foodshareclub/foodshare-web/tree/main/.agents/skills/ai-sdk
Command: npx skills add https://github.com/Foodshareclub/foodshare-web --skill ai-sdk-foodshareclub

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai.

What problem does it solve? Developers building AI features with the Vercel AI SDK often rely on outdated knowledge, since the SDK's APIs change frequently across versions. This Skill ensures AI SDK code is written against the version actually installed in the project, not stale training data. ## Core Features & Use Cases - Version-Matched Documentation Lookup: Reads bundled docs and source code inside node_modules/ai to verify every API, option, and pattern before writing code. - AI Feature Implementation: Helps build agents, chatbots, RAG systems, tool calling, structured output, embeddings, and streaming with generateText, streamText, ToolLoopAgent, and useChat. - AI Gateway Setup & Model Selection: Guides setup of the Vercel AI Gateway 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 package version, reads its bundled docs, and writes code using the current useChat and streamText APIs. ## Quick Start Ask the assistant to add a streaming chat endpoint to your app using the AI SDK version installed in this project.

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 in 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 at node_modules/ai/docs and the source at node_modules/ai/src to verify the exact signatures for your 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, either through provider packages like @ai-sdk/openai or through the Vercel AI Gateway. The Gateway lets you access multiple providers with a single API key using provider/model strings.

Why does my AI SDK code break after upgrading versions?

The AI SDK renames, removes, and adds APIs frequently between major versions, so code written from memory often fails. 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 choose which AI model to use with the AI SDK?

Never use model IDs from memory since models are released and retired frequently. Fetch the current list with curl https://ai-gateway.vercel.sh/v1/models and prefer the highest version number when multiple versions of a model exist.