All products
React Library

React AI Chat

Drop-in AI chat that looks like a product, not a demo.

Ship a real AI chat feature in a single afternoon.
See use cases ↓
One-time paymentLifetime updatesCommercial license
AI

Support Assistant

Powered by GPT-4o

How do I reset my API key?
You can rotate your API key from 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

Type a message…

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.

01

In-app AI assistants

Help your users do things in your product by chat. Streaming, tool calls, file uploads — all the pieces.

Ship a 'ChatGPT for your app' feature.
02

Customer support bots

Conversational UI over your docs, with tool calls to your API. Markdown and code blocks render correctly.

Cut support load with a real product, not a bot.
03

Document Q&A

Drop in a PDF or a doc set, get back citations and answers. Custom tools for retrieval, formatting, follow-ups.

Build a Perplexity clone over your data.
04

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.

AI as a feature, not as the whole product.

Built for

If any of these are you, this is for you.

AI engineers shipping chat featuresFull-stack devs adding AI to existing appsTeams standardising on the Vercel AI SDKIndie hackers building AI tools
Built withReact 18+TypeScriptTailwind CSSVercel AI SDK compatible

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.

terminal
$npm install react-ai-chat ai
$# Wrap your app in <ChatProvider>
$# Point useChat at your /api/chat route
$# Done — works with OpenAI, Anthropic, local

What's in the box

  • Chat component
    drop-in UI
  • useChat hook
    model-agnostic state
  • Streaming renderer
    token-by-token
  • Tool call cards
    input + output visible
  • File upload
    drag-and-drop
  • Markdown + code
    renders inline
  • Theme tokens
    light/dark/custom
  • Full source + docs
    no obfuscation

Full feature list

What makes this a real product, not a weekend hack.

useChat hook — connect to any LLM API
Streaming response rendering with typing indicators
Tool call visualization & inline results
Markdown & code block rendering
File upload with drag-and-drop
Conversation history management
Customizable theme (light/dark)
Built-in error handling & retry

Works with

Tested against the React stack you already use.

React 18+
peer dep
Vercel AI SDK
streaming + tools
OpenAI / Anthropic
any provider
Mistral / Cohere / Ollama
any provider
OpenRouter
multi-model
Tailwind CSS
styling

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

PropTypeDefaultDescription
configChatConfigrequiredAPI and chat configuration
titlestring'Chat'Header title
heightstring | number'100%'Container height
theme'light' | 'dark''light'Color theme
inputPlaceholderstring'Type...'Input placeholder
disabledbooleanfalseDisable chat
renderHeader() => ReactNodeCustom header
renderFooter() => ReactNodeCustom footer
renderEmpty() => ReactNodeCustom empty state

ChatConfig

PropTypeDefaultDescription
apiEndpointstringrequiredLLM API URL
headersRecord<string, string>Custom request headers
systemPromptstringSystem message
modelstringModel identifier
maxHistorynumber50Context window limit
initialMessagesChatMessage[]Seed messages
onError(error) => voidError 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