WebInfer

Transformers.js logo

Transformers.js

Browser-native Transformers models with WebGPU

Free
Local & Self-Hosted
Local

Configure Transformers.js

Enable Transformers.js in Settings

Go to Settings
About Transformers.js

Run Hugging Face Transformers models directly in the browser or server-side using WebGPU/WebAssembly. No API keys required, fully local inference with support for chat, vision, embeddings, and transcription.

Key Features
  • Runs fully in browser or Node.js
  • WebGPU acceleration for fast inference
  • Support for chat, vision, embeddings, transcription
  • Model download progress tracking
  • Web Worker support for off-main-thread execution
  • No API keys or cloud dependency
Capabilities
chat
vision
embeddings
transcription
local
browser
webgpu
Configuration Schema
Required and optional fields for configuring this provider
FieldTypeRequired
modelId
text
Required
device
text
Optional
dtype
text
Optional
CLI Usage
For users running the daemon server locally or a self-hosted gateway

Add provider:

npx webinfer provider add transformersjs

Test connection:

npx webinfer provider test transformersjs
Programmatic Usage
Use Transformers.js in your code with WebInfer

Basic usage:

import { generateText } from "webinfer"

// WebInfer automatically routes to the best available provider
const result = await generateText({
  prompt: "Write a haiku about programming"
})

console.log(result.text)

Specify Transformers.js explicitly:

import { generateText } from "webinfer"

const result = await generateText({
  prompt: "Write a haiku about programming",
  provider: "transformersjs",
  model: "HuggingFaceTB/SmolLM2-360M-Instruct"
})

console.log(result.text)
console.log("Provider:", result.provider)
console.log("Model:", result.model)

Streaming:

import { streamText } from "webinfer"

const { textStream } = await streamText({
  prompt: "Write a story about AI",
  provider: "transformersjs"
})

for await (const chunk of textStream) {
  process.stdout.write(chunk)
}
Pricing
Free
Completely free. All computation happens locally on your device.