Streaming Text
useCompletion — hook streaming AI responses in real time.
Try a prompt:
Ready
Click a prompt above to see streaming in action
The code:
import { useCompletion } from "@inferface/hooks";
const { completion, complete, isLoading, abort } =
useCompletion({ api: "/api/complete" });
// Fire a completion
await complete("Explain async/await");
// Stream renders automatically via `completion`Zero dependencies. @inferface/hooks handles SSE parsing, abort, error recovery, and state management. Works with OpenAI, Anthropic, or any SSE-compatible endpoint.