@inferface/hooks
v1.0.0-alpha.1
Published
Headless React hooks for streaming AI interfaces
Downloads
17
Maintainers
Readme
@inferface/hooks
Headless React hooks for streaming AI interfaces. Zero runtime dependencies.
Install
pnpm add @inferface/hooks
# or
npm install @inferface/hooksHooks
useStream— low-level SSE/ReadableStream primitiveuseCompletion— single-turn text completion with streaminguseChat— full conversational state with optimistic UIuseToolCalls— human-in-the-loop tool call approval flows
Quick start
import { useChat } from "@inferface/hooks";
function Chat() {
const { messages, send, isLoading } = useChat({ api: "/api/chat" });
return (
<div>
{messages.map(m => <p key={m.id}>{m.content as string}</p>)}
<button onClick={() => send("Hello")} disabled={isLoading}>Send</button>
</div>
);
}Documentation
Full docs and live demos at inferface.dev
License
MIT
