Three models, one prompt
Llama 70B · Llama 8B · Llama 4 Scout — same question, three answers, powered by your RAIS keyWhat you get
⚛useAIChat hook
Messages, loading, error, stop — all managed. Zero boilerplate.
🌐Any backend
Anthropic, OpenAI, Groq, FastAPI, Express — same hook, any server.
💚Vue 3 support
Same useAIChat API surface as a Vue 3 composable.
⚡Event hooks
onToken, onComplete, onError for side-effects and analytics.
🎨Drop-in UI
<Chat /> with Markdown + syntax highlighting, or bring your own.
✓Full TypeScript
Strict types, ESM + CJS, 117 passing tests across 8 packages.
As simple as this
import { useAIChat } from '@react-ai-stream/react'
import { Chat } from '@react-ai-stream/ui'
import '@react-ai-stream/ui/styles'
export default function Page() {
const {
messages, sendMessage,
loading, stop,
} = useAIChat({
endpoint: '/api/chat',
// OpenAI → Anthropic → Groq?
// Just change the route. Not the hook.
})
return (
<Chat
messages={messages}
onSend={sendMessage}
onStop={stop}
loading={loading}
/>
)
}The RAIS ecosystem
useAIChat hook + AIChatProvider
<Chat>, <MessageList>, <MarkdownRenderer>
Vue 3 composable — same API
raisMiddleware() for Express
stream_response() for FastAPI
RAIS Protocol v1
Three event types.
That's the entire spec.
Any server in any language that emits text, done, and error events over SSE is automatically compatible with every RAIS client.
data: {"type":"text","text":"…"}
data: {"type":"done"}
data: {"type":"error","error":"…"}
npx rais-compliance http://localhost:3000/api/chat