Next.js Integration
Build AI-powered Next.js applications with streaming, server components, and API routes.Quick Start
App Router
Client Component
Streaming Responses
API Route with Streaming
Client with Streaming
Pages Router
Server Components
With Tools
UIMessage Protocol
For compatibility with AI SDK’s useChat:Environment Variables
Configuration
Best Practices
- Use streaming - Better UX for long responses
- Handle errors - Show user-friendly error messages
- Add loading states - Indicate when AI is thinking
- Secure API routes - Add authentication
- Cache responses - For repeated queries
Related
- Server Adapters - Other server frameworks
- Agent - Agent configuration

