
Vercel AI SDK
Stream AI responses in React. useChat, useCompletion — works with any LLM provider.
In plain English
Like a phone line between your app and an AI brain. Your user asks a question, the SDK calls the AI, and streams the answer back word by word — just like how ChatGPT shows words appearing one at a time.
Real-world example
You're building a customer support page. Instead of an FAQ, you add a chat box. A customer types 'how do I cancel my subscription?' and the AI streams back a helpful answer using your docs — right inside your website.
Where this fits in your project
This handles the AI integration layer — streaming LLM responses from your backend to your frontend UI.
When to use this
When you want to add AI chat, completions, or streaming responses to your React app. Works with OpenAI, Anthropic, Google, and more.
The situation
You're adding a chatbot, AI assistant, or any AI-powered feature to your web app.
Good for
- + AI chatbots
- + Content generation features
- + AI-powered search
- + Any app with LLM features
Not ideal for
- - Apps without AI features
- - Backend-only AI processing (no UI)
Getting started
Install `npm install ai`, use the `useChat()` hook in React, create an API route that streams responses.