ai-sdk

Implements AI features with the Vercel AI SDK using verified current APIs.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill ai-sdk-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/AarnavBaddam/skills/tree/main/ai-sdk
Command: npx skills add https://github.com/AarnavBaddam/skills --skill ai-sdk-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? The Vercel AI SDK evolves rapidly, and LLM training data contains deprecated APIs like maxTokens, generateObject, and managed useChat input state. This Skill forces verification against bundled package docs and source code so generated code compiles and runs against the installed SDK version. ## Core Features & Use Cases - Verified API Usage: Searches node_modules/ai/docs/ and node_modules/ai/src/ before writing code, falling back to ai-sdk.dev documentation search. - Migration Error Reference: Maps deprecated patterns to current APIs, including parameters to inputSchema, maxSteps to stopWhen, and typed tool parts in useChat. - Agents and Providers: Guides ToolLoopAgent creation, type-safe useChat consumption via InferAgentUIMessage, Vercel AI Gateway setup, and DevTools debugging. - Use Case: When building a Next.js chat route with tool calling, the Skill checks the installed SDK version, fetches current model IDs from the AI Gateway, and applies the correct streaming response pattern. ## Quick Start Ask the AI to build a streaming chat endpoint with tool calling using the Vercel AI SDK and let it verify the current APIs from the installed package.

Frequently Asked Questions about ai-sdk

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

FAQPage Schema
How do I build a chat interface with the Vercel AI SDK?

Use the useChat hook from @ai-sdk/react with a DefaultChatTransport pointing to your API route, and manage input state manually with useState. On the server, return streamText results via toUIMessageStreamResponse.

How do I generate structured output with the AI SDK?

Use generateText with the output option instead of the deprecated generateObject. Pass Output.object with a Zod schema, or use Output.array, Output.choice, or Output.json depending on the shape you need.

Why does my AI SDK code fail typecheck with useChat?

Recent SDK versions removed managed input state and renamed tool part properties. Check the common errors reference: input and handleSubmit are replaced by sendMessage, and tool parts use typed names like tool-getWeather with part.input and part.output.

Which model provider should I use with the Vercel AI SDK?

The Vercel AI Gateway is the default provider, giving access to OpenAI, Anthropic, and Google models through one API. Always fetch current model IDs from the gateway endpoint rather than relying on memorized model names.

How do I debug AI SDK tool calls and agent runs?

Install @ai-sdk/devtools and wrap your model with devToolsMiddleware. All runs and steps are captured to .devtools/generations.json, which you can inspect directly or view in the web UI via npx @ai-sdk/devtools.