Transformers.js
Run Hugging Face Transformers directly in your browser with no server required
At a Glance
Pricing
Get started with Transformers.js at no cost with Free version available.
Engagement
Available On
About Transformers.js
Transformers.js is a powerful JavaScript library that brings Hugging Face's renowned Transformers ecosystem directly to web browsers and JavaScript environments. As the official JavaScript port of the Python Transformers library, it enables developers to run state-of-the-art machine learning models directly in the browser without requiring a server backend.
The library provides a unified API for working with transformer-based models across various modalities including text, images, audio, and multimodal applications. Functionally equivalent to its Python counterpart, Transformers.js allows web developers to leverage the same pretrained models with a familiar API. It supports a comprehensive range of tasks such as text generation, translation, summarization, question answering, image classification, object detection, speech recognition, and more.
Under the hood, Transformers.js utilizes WebAssembly (WASM) via ONNX Runtime and, since version 3.0, WebGPU for significant performance enhancements. The WebGPU integration enables browser-based GPU acceleration, delivering up to 100x faster inference than the WASM backend. The library also offers various quantization options (fp32, fp16, q8, q4) for optimizing model size and performance based on specific use cases and hardware capabilities.
With over 1,200 pre-converted models available and compatibility with Node.js, Deno, and Bun, Transformers.js has become the go-to solution for integrating AI capabilities into web applications and JavaScript environments. Its ability to run entirely client-side eliminates privacy concerns associated with sending data to external servers, reduces infrastructure costs, and enables offline functionality.

Community Discussions
Be the first to start a conversation about Transformers.js
Share your experience with Transformers.js, ask questions, or help others learn from your insights.
Pricing
Free Plan Available
Get started with Transformers.js at no cost with Free version available.
- Free version available
Capabilities
Key Features
- Run ML models directly in web browsers with no server required
- WebGPU support for up to 100x faster inference than WASM
- Multiple quantization formats (fp32, fp16, q8, q4) for performance optimization
- Support for 120+ model architectures and all major ML tasks
- Pipeline API for easy model usage with minimal code
- Compatible with Node.js (ESM/CJS), Deno, and Bun
- Over 1,200 pre-converted models available
- Multimodal support (text, image, audio, and combined)
- Client-side inference for enhanced privacy and reduced server costs
- Easy model conversion from PyTorch, TensorFlow, or JAX with Optimum