Use Laya from Node.js

You can run Laya inside a Node.js process with ONNX Runtime, or keep the model in a separate server and call it over HTTP. Both routes use the same state-plus-typed-questions request shape as the Python package and the Jev API.

141 projects

pi-laya

Dephilia

Routes prompts among model tiers and gates confidential prompts using a local Laya sidecar

0·GitHub repo

poc-laya

MayukhCars24

Measures Laya classification latency with a FastAPI backend, web console, and observability tools

0·GitHub repo

laya-ts

mikeboe

Serves the Laya model over an API and benchmarks it against the hosted Jev API

0·GitHub repo

pi-laya

izhimu

Integrates local Laya decision-model guardrails and judging into pi and oh-my-pi

0·GitHub repo

laya-retrieval

Sharjeelbaig

Selects evidence passages with Laya in an experimental two-stage retrieval system

0·GitHub repo

laya-tetris-ai

Sharjeelbaig

Demonstrates Laya choosing Tetris placements from candidate board evaluations

0·GitHub repo

laya-tetris-ai

htpu

Uses local Laya decisions to choose Tetris moves through a Chrome extension or Playwright bot

0·GitHub repo

laya-system-one

italoalmeida0

Provides a local JavaScript Laya decision engine with WebGPU and WASM acceleration

0·GitHub repo

jev-to-laya-proxy

diwakersurya

A Bun proxy exposes the TypeSafe Jev API and forwards requests to a local Laya server

0·GitHub repo

nocturn-gateway

yigiterturk-dev

Provides TypeScript and Python clients for a gateway to Jev and Laya

0·GitHub repo

simplotel-guest-concierge

Itachi-1824

A hotel guest assistant combines retrieval, Laya classification, and validated availability

0·GitHub repo

usejev

ali-master

Serves Laya through native ONNX inference on Bun with a TypeSafe-compatible API and bilingual playground

0·GitHub repo

ai-second-brain-lab

dante01yoon

Combines an Obsidian knowledge workflow, coding-assistant hooks, local Laya classification, and a 3D Markdown viewer

0·GitHub repo

jgent

Sube-py

Routes on-demand tool access in Pi using Jev or a local Laya model

0·GitHub repo

kime-compat

tamnd

Checks whether kime supports TypeSafe and Laya APIs, clients, SDKs, and tests

0·GitHub repo

Wayfinder

manish-9245

Serves Laya decisions through an HTTP gateway with policies, a web console and an MCP server

0·GitHub repo

fly-brain-agent

shenjie002

Drives a browser-based fruit-fly simulation with Laya decisions and spiking-neuron dynamics

0·GitHub repo

LayaOnAWS

goodbyedavid

Deploys a Laya inference server on Amazon ECS with GPU capacity in an AWS account

0·GitHub repo

Laya-Firehose

AdityaRawat00189

Ingests incoming data, classifies it with Laya, and routes items by urgency

0·GitHub repo

laya-studio

jiaheng6

Provides a Windows desktop client for installing, running, testing, and serving Laya models

0·GitHub repo

local-laya

maurostorch

Runs Laya as a Dockerized HTTP service with a web interface

0·GitHub repo

jev-laya-tetris

HarryReidx

Benchmarks TypeSafe Jev against local Laya in a competitive Tetris duel

0·GitHub repo

laya-code-router

SupremeDreamZ

Routes Claude Code and Codex turns using a local Laya model

0·GitHub repo

laya-mlx-voxel

yuxino

Builds voxel reliefs by using Laya-MLX to choose extrusion depths from image pixel statistics

0·GitHub repo

In-process: @receptron/laya

@receptron/laya runs the model with ONNX Runtime, so neither Python nor PyTorch is needed at runtime. It requires Node.js 20 or newer.

npm install @receptron/laya
import { Laya } from "@receptron/laya";

const laya = await Laya.load();

const result = await laya.systemOne(
  { subject: "Refund not received", body: "I cancelled two weeks ago and still have no refund..." },
  {
    department: {
      type: "choice",
      instructions: "Which team should handle this ticket?",
      criteria: { billing: "payments, refunds, invoices", support: "product help and bugs", sales: "new purchases" },
    },
    churn_risk: { type: "noul", instructions: "Is the customer likely to cancel or dispute?" },
  },
);

result.answers.department.choice; // "billing"
await laya.close();

Per its README, the fp32 ONNX weights are about 1.7 GB and download on first use. Budget roughly 2 GB of RAM. A three-question call takes about 140 ms on an Apple Silicon CPU once warm, and the output matches the Python implementation to four decimal places. The package is MIT-licensed; the weights are Apache 2.0.

Over HTTP: laya-studio

laya-studio is a zero-dependency TypeScript client for a running Laya server (Node.js 18.17+):

npm install laya-studio
pip install "laya[serve]"
laya-serve                          # binds 0.0.0.0:8000

Other JavaScript projects

  • @r4ai/laya-web: ONNX Runtime Web runtime for browsers and Node.js.
  • kevala: a Rust engine compiled to WebAssembly with WebGPU kernels, installable from npm.
  • gg-friggin-ez: a profanity and toxicity screener that defaults to Jev and can point at a local Laya endpoint.

Caveats

The English checkpoint's options must fit a 192-token budget and the state is cut at 512 tokens. The receptron README recommends fewer than about 20 options per choice question.

More ways to use Laya