Skip to main content

Signatures

Building an ImageInput

ImageInput.element is the browser-native path and the one you want. It is async, unlike every other constructor.

From a file input

createImageBitmap decodes off the main thread, and closing it afterwards releases the decoded pixels rather than waiting for GC.

From a camera

Throttle it. A VLM pass in WASM costs far more than a frame interval, so run one at a time and skip frames that arrive while a pass is in flight.

Streaming

Options

vlm takes the same LlmOptions as llm, so maxOutputTokens, temperature, and systemPrompt all apply.

Models

VLM runs on the llama.cpp backend, so the model must be a GGUF vision model with its projector. Register @runanywhere/web-llamacpp and pick a VLM entry from the catalog. Vision models are larger than text models, which matters more in a browser than anywhere else: check the download size before offering one.