API ReferenceLocal APIs
useLocalModel
React hook — on-device LLM chat over WebGPU.
Auto-generated from JSDoc in
packages/react/src/local/useLocalModel.ts. Do not edit — runnpm run docs:api.
useLocalModel
functionfunction useLocalModel(modelId: string, opts: UseLocalModelOptions): UseLocalModelMODELS
variableconst MODELS: BrowserModel[]LocalMessage
interfaceinterface LocalMessagerole: user | assistant
content: string
UseLocalModel
interfaceinterface UseLocalModelstatus: LocalModelStatus
progress: number
Weight-download progress, 0–1 (only meaningful while status === "loading").
messages: LocalMessage[]
error?: Error
load: () => Promise<LanguageModel>
Begin downloading + warming the model. Idempotent; safe to call eagerly for a progress bar.
send: (text: string) => Promise<void>
Send a user turn and stream the assistant reply into messages.
stop: () => void
Abort the in-flight reply.
reset: () => void
Clear the conversation.
UseLocalModelOptions
interfaceinterface UseLocalModelOptionsaccessToken?: string
Hugging Face token for gated/private repos.
autoLoad?: boolean
Start downloading the model on mount instead of waiting for the first send/load().
LocalModelStatus
type aliastype LocalModelStatus = idle | loading | ready | generating | error