ai-sdk

Guide Vercel AI SDK integration with doc-verified API usage.

885|108|Updated Apr 30, 2025
One-click install
npx skills add https://github.com/legions-developer/invoicely --skill ai-sdk-legions-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk
Source: https://github.com/legions-developer/invoicely/tree/main/.agents/skills/use-ai-sdk
Command: npx skills add https://github.com/legions-developer/invoicely --skill ai-sdk-legions-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers correctly use the AI SDK without relying on outdated API knowledge, reducing integration errors when building generation, streaming, tool-calling, and agent workflows.

Core Features & Use Cases

  • AI SDK function guidance: Covers core APIs like generateText, streamText, ToolLoopAgent, tool calling, structured output, and embeddings topics.
  • Provider and model selection: Guides you to use the Vercel AI Gateway and to fetch current model IDs instead of using stale ones.
  • Client and typing best practices: Helps with React hooks like useChat/useCompletion and common migration pitfalls and type-safety patterns for agents.

Quick Start

Ask: "How do I add tool calling and structured output to my Next.js chat using Vercel AI Gateway with the AI SDK?"

Frequently Asked Questions about ai-sdk

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

FAQPage Schema
How do I add tool calling and structured output to my Next.js chat using the Vercel AI SDK?

To add tool calling and structured output to your Next.js chat with the Vercel AI SDK, use generateText or streamText APIs combined with tool definitions, then validate the implementation against local node_modules docs or ai-sdk.dev to ensure API correctness.

What's the best way to discover current model IDs for OpenAI, Anthropic, and Google through the AI Gateway?

The best way to discover current model IDs for OpenAI, Anthropic, and Google through the AI Gateway is to query the /v1/models endpoint before writing model-specific code, preventing stale model ID integration errors in your AI SDK application.

How do I build a streaming chat UI with useChat without encountering outdated API issues?

To build a streaming chat UI with useChat without outdated API issues, follow doc-verified guidance for React hooks and type-safety patterns, validating the useChat implementation against the latest ai-sdk.dev references.

Does the Vercel AI SDK support building RAG-style workflows and agent tool loops?

Yes, the Vercel AI SDK supports building RAG-style workflows and agent tool loops by using ToolLoopAgent and embeddings topics, providing verified guidance for generation, streaming, and tool calling.

Do I need to install any specific packages before starting with the Vercel AI SDK?

You need to install the ai package first before starting with the Vercel AI SDK, which serves as the prerequisite dependency for validating APIs and accessing generation, streaming, and tool calling features.

Why do I get integration errors when using generateText and streamText in my AI application?

Integration errors with generateText and streamText often occur from relying on outdated API knowledge, so you should validate APIs by checking local node_modules docs/source or ai-sdk.dev to get up-to-date, doc-verified guidance.