React AI Chat
Drop-in AI chat that looks like a product, not a demo.
Support Assistant
Powered by GPT-4o
Settings → API. The old key stays valid for 24 hours.Tool call
get_user_settings(user_id="u_42")
→ 1 active API key, last rotated 14d ago
1 hour
Time to first message
Any LLM
Models supported
8
Built-in features
What you can build with it
Real scenarios where this pays for itself.
In-app AI assistants
Help your users do things in your product by chat. Streaming, tool calls, file uploads — all the pieces.
Customer support bots
Conversational UI over your docs, with tool calls to your API. Markdown and code blocks render correctly.
Document Q&A
Drop in a PDF or a doc set, get back citations and answers. Custom tools for retrieval, formatting, follow-ups.
AI-powered tools
Build AI features that aren't pure chat. The hook is just state — wire it into your own UI however you want.
Built for
If any of these are you, this is for you.
What's under the hood
Three things that earn their place in your stack.
Streaming you can feel
Token-by-token streaming with a typing indicator that doesn't lie. Markdown, code blocks, and tool calls render inline as they arrive.
Tool calls, not magic
First-class support for function calling. Tools render as collapsible cards with their inputs and outputs visible — no hidden LLM behavior.
Bring your own model
Works with the Vercel AI SDK. OpenAI, Anthropic, Mistral, OpenRouter, Ollama, your own fine-tune. Same hook, swap the endpoint.
Quick start
Install and ship in under a minute.
What's in the box
- Chat componentdrop-in UI
- useChat hookmodel-agnostic state
- Streaming renderertoken-by-token
- Tool call cardsinput + output visible
- File uploaddrag-and-drop
- Markdown + coderenders inline
- Theme tokenslight/dark/custom
- Full source + docsno obfuscation
Full feature list
What makes this a real product, not a weekend hack.
Works with
Tested against the React stack you already use.
Full documentation
Everything in the package, every prop, every pattern.
React AI Chat
Drop-in AI chat components for React apps. Streaming, tool calls, file uploads, markdown — everything you need.
Quick Start
npm install react-ai-chat
Usage
Full chat component
import { Chat } from 'react-ai-chat'
function App() {
return (
<Chat
config={{
apiEndpoint: '/api/chat',
systemPrompt: 'You are a helpful assistant.',
model: 'gpt-4',
}}
title="AI Assistant"
height={600}
/>
)
}
Custom hook (build your own UI)
import { useChat, MessageBubble, ChatInput } from 'react-ai-chat'
function CustomChat() {
const { messages, sendMessage, isLoading, error } = useChat({
apiEndpoint: '/api/chat',
})
return (
<div className="chat-container">
{messages.map((msg) => (
<MessageBubble key={msg.id} message={msg} />
))}
{isLoading && <TypingIndicator />}
<ChatInput onSend={sendMessage} isLoading={isLoading} />
</div>
)
}
API endpoint format
The chat component expects your API to return streaming responses in SSE format:
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" world"}}]}
data: [DONE]
Or a non-streaming JSON response:
{
"choices": [{
"message": {
"content": "Hello world",
"tool_calls": [...]
}
}]
}
Tool calls
// The component automatically renders tool calls with status indicators
// Your API should include tool_calls in the stream delta:
{
"choices": [{
"delta": {
"tool_calls": [{
"id": "call_123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"NYC\"}"
}
}]
}
}]
}
API
Chat
| Prop | Type | Default | Description |
|---|---|---|---|
| config | ChatConfig | required | API and chat configuration |
| title | string | 'Chat' | Header title |
| height | string | number | '100%' | Container height |
| theme | 'light' | 'dark' | 'light' | Color theme |
| inputPlaceholder | string | 'Type...' | Input placeholder |
| disabled | boolean | false | Disable chat |
| renderHeader | () => ReactNode | — | Custom header |
| renderFooter | () => ReactNode | — | Custom footer |
| renderEmpty | () => ReactNode | — | Custom empty state |
ChatConfig
| Prop | Type | Default | Description |
|---|---|---|---|
| apiEndpoint | string | required | LLM API URL |
| headers | Record<string, string> | — | Custom request headers |
| systemPrompt | string | — | System message |
| model | string | — | Model identifier |
| maxHistory | number | 50 | Context window limit |
| initialMessages | ChatMessage[] | — | Seed messages |
| onError | (error) => void | — | Error handler |
useChat
const {
messages, // ChatMessage[]
sendMessage, // (text: string) => Promise<void>
isLoading, // boolean
error, // Error | null
clearMessages, // () => void
stopGeneration, // () => void
updateMessage, // (id, updates) => void
} = useChat(config)
Common questions
Things people ask before buying.
Do I need a backend?
Yes — you need an endpoint that calls your LLM. The library is the UI; the proxy is your call. We recommend the Vercel AI SDK's `streamText`.
Does it work with non-OpenAI models?
Yes. Anything the Vercel AI SDK supports works: OpenAI, Anthropic, Mistral, Cohere, Ollama, OpenRouter. The chat UI doesn't care.
Can I customize the theme completely?
Yes. Pass `theme` with token overrides, or replace individual components (message bubble, input, tool card) via the `slots` prop.
How are conversations persisted?
It's your call. The hook takes a `messages` array you control. Save to localStorage, IndexedDB, your server, or a managed service — same code.
£25 — lifetime
One purchase. Yours forever.
Pay once via Stripe. Get the complete package instantly. Free updates for the same major version. Commercial license included.
Secure payment via Stripe · Instant download · 30-day money-back if it doesn't save you time