Overview
Vercel AI SDK is a TypeScript toolkit for building AI-powered applications with React, Next.js, Vue, and Svelte. RedPill works seamlessly with Vercel AI SDK using the OpenAI provider.Perfect for building streaming chat UIs, AI-powered forms, and interactive AI experiences.
Installation
Basic Setup
Text Generation
Streaming Text
Next.js Chat Application
Route Handler (app/api/chat/route.ts)
Chat UI Component (app/page.tsx)
Environment Variables (.env.local)
Tool Calling (Function Calling)
Streaming with Tool Calls
Multi-Model Support
Switch between different AI providers seamlessly:React Server Components
Structured Output
Generate type-safe structured data:Error Handling
Supported Models
All RedPill models work with Vercel AI SDK:Model | Use Case |
---|---|
openai/gpt-4o | General purpose, chat |
anthropic/claude-3.5-sonnet | Reasoning, analysis |
deepseek/deepseek-chat | Coding, technical tasks |
google/gemini-2.0-flash | Fast responses |
phala/qwen-2.5-7b-instruct | Confidential data (TEE) |
View All Models
Browse 218+ supported models →
Example Use Cases
Chatbot
Build a streaming chat interface with Next.js
Content Generator
Generate blog posts, summaries, and creative content
AI Forms
Create forms with AI-powered suggestions
Data Extraction
Extract structured data from unstructured text