A Python framework for building LLM-powered applications and agents, with standard interfaces for models, embeddings, vector stores and third-party integrations.
vercel/ai
A provider-agnostic TypeScript toolkit for building AI-powered applications and agents with React, Next.js, Svelte, Vue and Node.js.
- Stars
- 27,412
- Forks
- 5,390
- Open issues
- 1,373
- Last commit
- 5 hours ago
What is it?
The AI SDK is a TypeScript library for building AI-powered applications and agents. It offers a unified API across model providers such as OpenAI, Anthropic and Google, so switching models mostly means changing a model string or provider package rather than rewriting application code.
Beyond plain text generation, it supports generating structured data validated against a schema (using Zod), tool-using agents through a ToolLoopAgent abstraction, and streaming responses. By default, model strings are routed through the Vercel AI Gateway, while provider packages such as @ai-sdk/openai can be used to connect directly.
The AI SDK UI module provides hooks such as useChat for building chat interfaces and generative UI. These hooks are framework-agnostic and work with Next.js, React, Svelte and Vue.
Key features
- 01Unified API across model providers such as OpenAI, Anthropic and Google.
- 02Structured output generation validated with Zod schemas.
- 03ToolLoopAgent abstraction for building tool-using agents.
- 04UI hooks such as useChat for chat and generative interfaces.
- 05Works with Next.js, React, Svelte, Vue and Node.js runtimes.
Use cases
- Adding a chat interface with streaming responses to a Next.js or React app.
- Extracting structured JSON from model output in a TypeScript backend.
- Building agents that call tools such as shell commands or image generation.
Quick start
- 1
Install Node.js 22+ and npm, then install the AI SDK package
npm install ai - 2
Install the provider SDK packages you want to use directly (optional)
npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google - 3
Call generateText with a model string in your code (uses Vercel AI Gateway by default)
Things to know
- Default model routing goes through the Vercel AI Gateway, which may require a Vercel account or API key.
- The README's example model names may not match the providers' currently available models, so check the docs before using them.
Topics
FAQ
- What is ai?
- A provider-agnostic TypeScript toolkit for building AI-powered applications and agents with React, Next.js, Svelte, Vue and Node.js. The AI SDK is a TypeScript library for building AI-powered applications and agents. It offers a unified API across model providers such as OpenAI, Anthropic and Google, so switching models mostly means changing a model string or provider package rather than rewriting application code.
- Is ai free to use? What license does it have?
- ai is open source under the Other license. Check the license terms before using it in commercial products.
- Is ai still maintained?
- Actively maintained. The last commit to ai was on Oct 20, 2026.
- What can I use ai for?
- Adding a chat interface with streaming responses to a Next.js or React app. Extracting structured JSON from model output in a TypeScript backend. Building agents that call tools such as shell commands or image generation.
- How do I install ai?
- Install Node.js 22+ and npm, then install the AI SDK package: npm install ai Install the provider SDK packages you want to use directly (optional): npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google Call generateText with a model string in your code (uses Vercel AI Gateway by default)
- Where can I get ai?
- The source code and installation instructions are on GitHub: https://github.com/vercel/ai
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Local, open-source AI app builder that runs on your machine and lets you bring your own AI API keys, an alternative to Lovable, v0 and Bolt.
A community-curated open-source library of prompts for AI chat models, with a website, CSV/Hugging Face datasets, CLI and MCP server integration.
A TypeScript coding agent CLI where a single 'ulw' or 'mass ulw' keyword in your prompt makes it plan, delegate to multiple models, and verify the work.
A TypeScript SDK for building agent-native apps with generative UI, shared state, and human-in-the-loop flows in React, Angular, Vue, and chat apps.
A TypeScript framework for building AI agents and LLM-powered applications, with workflows, tools, memory, MCP servers, and evals.