Modular Design: Install only what you need for a lighter app.Explore Playground
The most powerful React framework for building AI applications with built-in authentication, database, payments, and OpenAI integration.
// AI chat component with streaming responses
export function AIChat() {
const { messages, sendMessage } = useAIChat();
return (
<div className="p-4 border rounded-lg">
<div className="h-80 overflow-y-auto space-y-2 mb-4">
{messages.map((message, i) => (
<div key={i} className={message.role === 'user' ? 'text-sky-600' : 'text-emerald-600'}>
<span className="font-bold">{message.role}:</span> {message.content}
</div>
))}
</div>
<form onSubmit={(e) => {
e.preventDefault();
const input = e.currentTarget.elements.namedItem('message');
if (input instanceof HTMLInputElement) {
sendMessage(input.value);
input.value = '';
}
}}>
<input name="message" className="w-full p-2 rounded border" placeholder="Ask anything..." />
</form>
</div>
);
}
Everything you need to build production-ready AI applications, in one simple package.
Authentication, database, payments, and AI integration — all pre-configured and ready to use.
Install only what you need. Each integration is optional, making your app lighter and faster.
Built with Next.js 14, TypeScript, and Tailwind CSS for a modern, type-safe developer experience.
OpenAI integration with streaming responses and an optimized developer experience for AI apps.
Our components handle the complexity so you can focus on your product. From streaming chat interfaces to payment processing, we've got you covered.
Powered by ai-base
Hello! How can I help you today?
Can you explain how to use the AI chat component in ai-base?
Using the AI chat component is simple! First, install the package:
Then import and use the component in your React app:
That's it! The component handles OpenAI integration, streaming responses, and chat history automatically.
Get started with ai-base in minutes. No configuration required.
npx create-next-app -e https://github.com/yourusername/ai-base