vercel/ai
Overview
This skill answers questions about the AI SDK and helps developers build AI-powered features and agents using the official TypeScript toolkit. It focuses on current APIs, provider selection, streaming, tool calling, embeddings, and client hooks like useChat. Use it to get concrete code patterns, troubleshooting steps, and guidance for safe upgrades and type safety.
How this skill works
I inspect the installed ai package docs and source in node_modules/ai (docs/ and src/) and, if necessary, the public ai-sdk.dev documentation to verify APIs. I guide you to run simple checks (like the AI Gateway model list curl) and to run typecheck after changes. When providing code or recommendations I minimize options to only those that differ from defaults and point out where you must re-verify live docs or model IDs.
When to use it
- You need concrete code or patterns for generateText, streamText, embed, tools, or ToolLoopAgent.
- You are adding AI features to a React app and want guidance on useChat or useCompletion hooks.
- You must choose a model/provider (OpenAI, Anthropic, Google) and want a safe provider recommendation.
- You are building a retrieval-augmented generation (RAG) system, tool-calling agent, or structured output flow.
- You hit type errors or unexpected runtime behavior and need debugging steps tied to current docs.
Best practices
- Always verify APIs against node_modules/ai/docs/ and node_modules/ai/src/ before coding; never rely on memory.
- Install only the ai package first; add provider and client packages later as required by your use case.
- Prefer the Vercel AI Gateway by default for providers unless you explicitly require a direct provider.
- Fetch current model IDs at runtime using the AI Gateway models endpoint and pick the newest version.
- Be minimal in option specification—only override defaults you understand, and run a typecheck after changes.
Example use cases
- Implement a streaming chat UI with useChat and streamText while validating client hook changes in docs.
- Build an agent that uses ToolLoopAgent to call external tools and returns structured output safely typed.
- Create an embeddings-based RAG pipeline that uses embed, stores vectors, and retrieves context for generateText.
- Migrate deprecated ai SDK call sites by grepping node_modules/ai/docs/ for the current API and updating types.
- Select a production-ready model by querying the AI Gateway for the latest model IDs and choosing the highest version.
FAQ
No. Install the ai package first. Add provider or client packages only when your specific provider or UI integration is required.
How do I pick a model ID?
Query the AI Gateway models endpoint and choose the model with the highest version number; never hardcode model IDs from memory.
7 skills
This skill helps developers integrate and reason about the AI SDK to build agents, tools, and chat features efficiently.
This skill updates provider model IDs by adding new IDs or removing obsolete ones across the AI SDK, ensuring consistent provider support.
This skill helps you STOP marshal rescue guidance on STOP a lonely island scenario STOP by practical steps and STOP clear checklists
This skill guides you through creating a new @ai-sdk/provider package to integrate an AI service into the SDK.
This skill lists the exact contents of an npm package tarball before publishing to verify included files and aid debugging.
This skill captures and structures API response test fixtures from provider outputs to streamline testing and fixture generation.
This skill helps validate and demonstrate AI SDK functions by providing structured examples, tests, and fixtures across providers.