Run Laya in the browser

Laya is small enough to run in a browser tab with no server and no API key. The input never leaves the page. The trade-off is a download of several hundred megabytes on the first visit and much slower inference than a native runtime.

171 projects

laya-bot-det

koteitan

Classifies Nostr authors as bots with Laya running in the browser

0·GitHub repo

laya-mlx-wzq

smile-magic

A browser-based Gomoku game runs Laya-MLX locally to choose moves on Apple Silicon

0·GitHub repo

laya-dev

AVMG20

A local HTTP server exposes Laya through a Jev-compatible API and includes a browser playground

0·GitHub repo

laya-local

vit-cerny

Runs a browser agent using local Laya decisions or TypeSafe's hosted Jev backend

0·GitHub repo

laya-email

sreekar2403

Tags Gmail messages locally with five Laya-powered classifications in one pass

0·GitHub repo

lunar-laya

mraad

Runs Laya typed decisions on Apple MLX to guide a lunar-landing simulation

0·GitHub repo

laya-curso

inematds

Teaches structured decisions with Laya and Jev through lessons, exercises, and practical projects

0·GitHub repo

laya-flappy

cohenom

Uses the Laya model to vote on live game states in a flappy-bird-style physics game

0·GitHub repo

laya-test

petrixh

Runs Laya as the decision-making pilot in a browser game with reproducible evaluations

0·GitHub repo

laya-int8

koteitan

Provides an int8-quantized Laya Multilingual ONNX model split into downloadable parts

0·GitHub repo

docker-laya-api

TheNerdMan

Packages the Laya decision model as a containerized HTTP API with an optional browser demo

0·GitHub repo

lunar-mpc-laya

mraad

Pairs Laya with adaptive model-predictive control in a lunar lander decision game

0·GitHub repo

laya-demo-web

sriramkasyap

Provides a browser playground for sending decision requests to a self-hosted Laya API

0·GitHub repo

laya-snake-arena

sathwikkuncham

Compares local Laya and Jev decision engines in a configurable Snake arena

0·GitHub repo

jev-laya-chess-bench

abe17124

Compares TypeSafe Jev and Laya in head-to-head chess games using legal moves

0·GitHub repo

jev-laya-japanese-business-benchmark

snsk

Compares Jev and Laya on a Japanese business decision benchmark

0·GitHub repo

ai-decision-lab

uibuckets

Provides a local playground and benchmark harness for Laya, with optional Jev comparisons

0·GitHub repo

slop-finder

Code-Wizard-Wilson

Detects AI-like writing styles in social feeds using a local Laya-MLX helper

0·GitHub repo

jev-zen

loongWoong

Reconstructs and validates Laya inference locally using NumPy and a browser-based interface

0·GitHub repo

before-you-send

roisol144

Checks message tone, formality and fight risk while users type, using Laya decisions

0·GitHub repo

mailaya

htpu

Uses a local Laya model to triage email, flag phishing, and check drafts in a browser extension

0·GitHub repo

laya

iaeluk

Runs a local Laya-powered Snake game with a CUDA server and browser version

0·GitHub repo

laya

Yahia-Raouf

Provides a self-hosted Laya inference API, key management, and an administration portal

0·GitHub repo

laya-t-rex-runner

10086ggqq

A browser-based T-Rex runner uses typed-decision models and distilled agents to choose actions

0·GitHub repo

Libraries

kevala is a zero-dependency Rust engine compiled to WebAssembly, with WebGPU kernels. It works from any page:

<script type="module">
  import { Kevala } from "https://cdn.jsdelivr.net/npm/kevala@latest/js/src/index.js";
  const kevala = await Kevala.load({ model: "laya", onProgress: console.log });
</script>

or pnpm add kevala. According to its README, the Laya int8 pack is 479 MB and is kept in browser storage after the first visit.

@r4ai/laya-web runs ONNX Runtime Web with WebGPU and a WebAssembly SIMD fallback, and is designed to run in a Web Worker:

npm install @r4ai/laya-web onnxruntime-web

Demos you can open

  • layaForWeb: the English checkpoint as quantized ONNX (default build about 440 MB), with a live demo.
  • open-jev-laya: multilingual Laya on Transformers.js (fp16 ONNX about 647 MB) with Gomoku, Big Two and a 3D maze.
  • layaAsRagJudge: checks RAG claims against retrieved evidence entirely in the tab.

Speed and support

The layaForWeb README reports that a three-question call on the default WASM backend took about 2 to 5 seconds on a 2-core machine. In that project, WebGPU works only with the int4 build, because ONNX Runtime's WebGPU MatMulNBits kernel supports 2- and 4-bit weights. open-jev-laya tries WebGPU and falls back to WebAssembly.

Caveats

Quantized browser builds do not match PyTorch exactly. layaForWeb reports 97.9% top-answer agreement for all three of its quantized builds, with the largest probability gaps in int4. For a real-time loop, laya-pong keeps the model native. Its README gives the reason: the checkpoint wants about 2.4 GB resident in f32, and wasm32 has a 4 GB address space and no Metal.

More ways to use Laya