Valora
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 — run npm run docs:api.

useLocalModel

function
function useLocalModel(modelId: string, opts: UseLocalModelOptions): UseLocalModel

MODELS

variable
const MODELS: BrowserModel[]

LocalMessage

interface
interface LocalMessage

role: user | assistant

content: string

UseLocalModel

interface
interface UseLocalModel

status: 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

interface
interface UseLocalModelOptions

accessToken?: 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 alias
type LocalModelStatus = idle | loading | ready | generating | error

On this page

Valora is local-first

No API key, no server — everything in this doc runs on-device.

Star on GitHub