Production-ready AI chat interface with tool calling, streaming, and multi-provider support
Built with Vercel AI SDK Β· AI Elements Β· Next.js 15 Β· TypeScript
Website Β· Features Β· Quick Start Β· Documentation Β· Examples
A polished, production-ready starter template for building AI agents with conversational interfaces. Features streaming responses, multi-step tool calling, web search with citations, and support for multiple AI providers.
Perfect for building:
- AI assistants with custom tools and knowledge
- Research agents with web search and citations
- Data analysis tools with database integration
- Customer support bots with contextual awareness
- Internal tools with API integrations
|
Real-time Streaming
Smart History
|
Advanced Interactions
|
| Provider | Models | Features |
|---|---|---|
| OpenAI | GPT-5, GPT-4o, o4-mini | Reasoning, tools, web search |
| Groq | DeepSeek R1 (70B) | Fast inference, reasoning |
| AI Gateway | All providers | Unified routing, cost optimization |
- Runtime switching - Change models mid-conversation
- Reasoning display - Collapsible thought process for o-series models
- Token tracking - Monitor input/output usage
// Example: Weather tool
const weather = await getWeather({ city: "San Francisco" });
// β { temp: 72, conditions: "Sunny" }- β° getTime - Current server time
- π€οΈ getWeather - Mock weather data (template for real APIs)
- π summarizeAttachments - File content analysis
- π web_search - OpenAI built-in search (optional toggle)
β See src/lib/ai/tools/examples/ for API, database, and search templates
- π¨ Theme toggle - Light/dark mode with
next-themes - π± Mobile responsive - Works on all screen sizes
- β¨οΈ Keyboard shortcuts -
Cmd+Knew chat,Cmd+Entersend - βΏ Accessible - ARIA labels, keyboard navigation
- β TypeScript strict mode - Full type safety
- π§ ESLint + Prettier - Code quality enforcement
- π₯ Hot reload - Instant feedback during development
- π Comprehensive docs - Architecture, deployment, contributing guides
- π§© Modular design - Easy to extend and customize
- Node.js 18+ (Download)
- pnpm (
npm install -g pnpm) - OpenAI API key (Get one here)
# Clone the repository
git clone https://github.com/thorchh/agent-starter.git
cd agent-starter
# Install dependencies
pnpm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local and add your OPENAI_API_KEY
# Start the development server
pnpm devOpen http://localhost:3000 to see your app! π
- Try the chat - Navigate to
/chatand ask "What time is it?" - Test tool calling - The AI will call the
getTimetool - Enable search - Toggle web search and ask "Latest news about AI"
- Customize - Edit
src/lib/ai/system-prompt.tsto change behavior
// src/lib/ai/tools/getStockPrice.ts
import { tool } from "ai";
import { z } from "zod";
export const getStockPrice = tool({
description: "Get the current stock price for a symbol",
parameters: z.object({
symbol: z.string().describe("Stock ticker symbol (e.g., AAPL)"),
}),
execute: async ({ symbol }) => {
// Replace with real API call
const price = Math.random() * 1000;
return {
symbol,
price: price.toFixed(2),
currency: "USD",
};
},
});
// src/lib/ai/tools/index.ts
export const tools = {
getTime,
getWeather,
getStockPrice, // β Add your tool
};// Use Groq for faster inference
AI_MODEL=groq/deepseek-r1-distill-llama-70b
// Use AI Gateway for cost optimization
AI_MODEL=gateway/openai/gpt-5
AI_GATEWAY_API_KEY=vck-...// .env.local
ENABLE_REASONING=true
OPENAI_REASONING_SUMMARY=detailed
OPENAI_REASONING_EFFORT=highagent/
βββ src/
β βββ app/
β β βββ api/chat/ # Streaming chat endpoint
β β βββ chat/[id]/ # Chat page (dynamic route)
β β βββ page.tsx # Landing page
β βββ components/
β β βββ chat/ # Chat UI (Client, Sidebar, MessageParts)
β β βββ ai-elements/ # AI Elements components
β β βββ ui/ # shadcn/ui primitives
β βββ lib/
β βββ ai/
β β βββ provider.ts # Multi-provider routing
β β βββ models.ts # Model allowlist & config
β β βββ tools/ # Tool registry
β β βββ system-prompt.ts
β βββ chat/
β βββ server/ # File-based chat store
β βββ store/ # Store implementations
βββ .env.example
βββ ARCHITECTURE.md # System design deep dive
βββ DEPLOYMENT.md # Production deployment guide
βββ CONTRIBUTING.md # Development guidelines
| Variable | Required | Description | Default |
|---|---|---|---|
OPENAI_API_KEY |
β | OpenAI API key | - |
GROQ_API_KEY |
β | Groq API key for DeepSeek R1 | - |
AI_GATEWAY_API_KEY |
β | Vercel AI Gateway key | - |
AI_MODEL |
β | Default model ID | openai/gpt-5 |
ENABLE_REASONING |
β | Show reasoning for o-series models | false |
OPENAI_REASONING_SUMMARY |
β | Reasoning detail level | auto |
OPENAI_REASONING_EFFORT |
β | Reasoning effort | high |
See .env.example for full configuration.
| Document | Description |
|---|---|
| ARCHITECTURE.md | System design, data flow, and key decisions |
| DEPLOYMENT.md | Production deployment with Vercel/Supabase |
| CONTRIBUTING.md | Development setup and guidelines |
| Tool Examples | Database, API, and search tool templates |
For production use, you'll need to upgrade from the file-based storage:
- Database - Set up Vercel Postgres or Supabase (see DEPLOYMENT.md)
- Blob Storage - Configure S3/R2/Vercel Blob for file attachments
- Authentication - Add NextAuth, Clerk, or Supabase Auth
- Rate Limiting - Implement per-user/IP rate limits
- Monitoring - Set up Sentry, Vercel Analytics, or similar
See DEPLOYMENT.md for detailed instructions.
| Category | Technologies |
|---|---|
| Framework | Next.js 16 (App Router), React 19 |
| Language | TypeScript 5 (strict mode) |
| AI | Vercel AI SDK 6.0, AI Elements |
| UI | Tailwind CSS 4, shadcn/ui, Radix UI |
| Providers | OpenAI, Groq, AI Gateway |
| Dev Tools | ESLint, pnpm, Hot Reload |
Contributions are welcome! Please see CONTRIBUTING.md for:
- Development setup
- Code style guidelines
- Testing requirements
- Pull request process
This is a starter template. Use it however you like - MIT License.
Built with:
- Vercel AI SDK - AI framework
- AI Elements - Pre-built UI components
- shadcn/ui - UI component library
- Next.js - React framework
β Star this repo if you find it useful!
Website Β· Documentation Β· GitHub
Made with β€οΈ for the AI community


