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-test

jafs

Provides a web playground for testing Laya typed decisions on text or JSON

0·GitHub repo

werewolf-laya

CallSohail

Runs a Werewolf game in which bots use Laya to score suspicions, choose intentions, and vote

0·GitHub repo

laya-studio

song-chaoyang

Provides a web interface for Laya inference, language detection, email tools, and shortlist demos

0·GitHub repo

laya-dino

JakkNaj

A fine-tuned Laya model plays Chrome Dino using a Python backend and TypeScript frontend

0·GitHub repo

laya-demo

clonekim

Provides a local server and browser interface for classifying text with Laya

0·GitHub repo

laya-minesweeper

Animal2404

Demonstrates and evaluates Laya’s mine-risk judgments against a Minesweeper constraint solver

0·GitHub repo

laya-adblock

Samuel-Ku

Uses a local MLX Laya model to identify and remove likely ads from web pages

0·GitHub repo

laya-snake

D9-cell

Runs Laya in Rust to play Snake in a terminal or browser dashboard

0·GitHub repo

laya-tetris

kuchris

Runs Laya as a Tetris placement decision-maker with a heuristic safety guard

0·GitHub repo

laya-models

dockndevai

Provides quantized ONNX builds of Laya for browser inference

0·GitHub repo

laya-server

MrLYC

Provides an authenticated CPU-based HTTP service and decision console for Laya models

0·GitHub repo

Laya_Playground

jonas050210

Runs local Laya decision demos, games, and a raw playground through a browser interface

0·GitHub repo

sway-laya

CallSohail

A Gradio word game where players try to elicit specific decisions from Laya

0·GitHub repo

laya-console

wearshoes

A console provides API keys, a playground, and usage tools for the Laya decision API

0·GitHub repo

snake-AI

jhao

A browser Snake game with switchable local Laya and hosted Jev decision engines

0·GitHub repo

laya-snake-ai

ArjunSonara

Integrates Laya decisions into a Snake game that navigates hazards and hunts apples

0·GitHub repo

keemsisi-laya-js

keemsisi

Provides JavaScript clients and a Node server adapter for Laya typed decisions

0·GitHub repo

exp-laya-router

zheyar-ltd

Demonstrates a CUDA-based Laya policy router in real-time Snake and Tetris games

0·GitHub repo

laya-snake-ai

IrMaho

Runs a tactical Snake arena powered by the local Laya decision model

0·GitHub repo

keemsisi-tetris-laya

keemsisi

Lets players control Tetris with decisions from the Laya model

0·GitHub repo

laya-capability-business

matrix-air

Presents experiments measuring Laya’s capabilities, limitations, fine-tuning, and runtime migration

0·GitHub repo

laya-vs-jev

darrenli6

Compares Laya and Jev in snake-racing and fighting-game arenas

0·GitHub repo

jev-vs-laya

janagarajsn

A Flask app benchmarks Jev and local Laya on synthetic customer-support tickets

0·GitHub repo

laya-answer-router

ramb5144

A Chrome side panel and MCP bridge use local Laya to route page questions to OpenAI models

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