ai-sdk

Answer questions and implement AI features using the Vercel AI SDK.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ai, @ai-sdk/react, @ai-sdk/devtools, @ai-sdk/gateway, zod, and includes references (resource) components.

What problem does it solve? Developers working with the Vercel AI SDK often rely on outdated training knowledge, leading to deprecated APIs, wrong parameter names, and broken type checks. This Skill forces verification against current documentation and source code before writing any AI SDK code. ## Core Features & Use Cases - Up-to-date API guidance: Searches bundled docs in node_modules/ai/docs/ and ai-sdk.dev instead of relying on memory, covering generateText, streamText, ToolLoopAgent, embed, and tools. - Migration and error resolution: Maps deprecated patterns (maxTokens, maxSteps, parameters, generateObject, toDataStreamResponse) to their current replacements via a common-errors reference. - Type-safe agent building: Guides creation of ToolLoopAgent agents with InferAgentUIMessage for end-to-end type safety with useChat in React. - Use Case: A developer asks to add a streaming chatbot to a Next.js app; the Skill checks the installed ai package version, fetches current model IDs from the Vercel AI Gateway, and generates code using toUIMessageStreamResponse and DefaultChatTransport. ## Quick Start Ask the assistant to build a streaming chat endpoint with the AI SDK and have it verify the current API against the installed ai package docs.

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 ToolLoopAgent class with a model, instructions, and a tools object. Search node_modules/ai/docs/ for the current agent creation API, and export InferAgentUIMessage<typeof agent> for type-safe consumption with useChat.

How to fix deprecated AI SDK parameters like maxTokens and maxSteps?

Replace maxTokens with maxOutputTokens, maxSteps with stopWhen: stepCountIs(n), and tool parameters with inputSchema. The common-errors reference documents each renamed parameter with before-and-after code examples.

Does useChat still manage input state in the AI SDK?

No, useChat no longer manages input state internally. Manage input with useState, pass a transport like new DefaultChatTransport({ api }), and call sendMessage({ text: input }) on submit.

How do I get structured JSON output from generateText?

Use generateText with the output option instead of the deprecated generateObject. Pass Output.object({ schema }) with a Zod schema, or use Output.array, Output.choice, or Output.json for other shapes.

Which model ID should I use with the Vercel AI Gateway?

Never use model IDs from memory. Run curl against https://ai-gateway.vercel.sh/v1/models and filter by provider prefix with jq, then pick the model with the highest version number, such as claude-sonnet-4-5 over claude-sonnet-4.

Why does my AI SDK TypeScript code fail typecheck after upgrading?

Type errors usually come from renamed APIs like toDataStreamResponse, tool-invocation parts, or addToolResult. Grep the common-errors reference for the failing property name before searching source code.