Laya for Go, Java, Elixir, Ruby and Zig

Beyond Python and JavaScript, the community has ported Laya to several other languages. Most run an ONNX export with ONNX Runtime, a few reimplement the model natively, and some are thin clients for a Python process or HTTP server.

33 projects

Go

laya-onnx (MstyAI) is a Go library and CLI on ONNX Runtime for macOS and glibc Linux:

go install github.com/MstyAI/laya-onnx/cmd/laya-onnx@latest
laya-onnx prepare

Preparation downloads about 819 MiB. laya-go (lengoman) (go get github.com/lengoman/laya-go) is a Go client that drives a Python laya sidecar or server. system-one-router is a Go LLM gateway that uses local Laya or Jev to pick a model.

Java

Laya4j runs the multilingual checkpoint through ONNX Runtime Java and needs Java 17+:

<dependency>
    <groupId>com.laya4j</groupId>
    <artifactId>laya4j-core</artifactId>
    <version>0.2.0</version>
</dependency>

It mirrors the Python presets (triage, guard, moderation, model router). The README reports 148 ms p50 for a 5-question predict on a Mac M4 CPU.

Elixir

laya_ex is a native Nx/Bumblebee runtime that downloads the official checkpoint on first load. It does not choose an Nx backend, so configure one, for example EMLX.Backend on Apple Silicon or EXLA.Backend on CPU and NVIDIA.

Ruby

ruby-laya is a port with a Router and a declarative Laya::Decision class, running on ONNX Runtime (Ruby 3.3+):

bundle add ruby-laya

laya (EduardoGHdez) is a smaller gem (gem "laya") that runs the receptron ONNX export on CPU.

Zig

zlaya is a CPU-only engine that can also build to WebAssembly. It needs Zig nightly:

zig build -Doptimize=ReleaseFast
sh scripts/download-model.sh models/laya
zig-out/bin/zlaya models/laya examples/triage.json

The README gives about 1.7 GiB of RAM for loading and inference. laya-zig is a dependency-free Zig runtime for the multilingual model, and its author labels it a work in progress.

Caveats

These are independent community projects with different maturity levels. Check each one's parity tests against the Python reference before relying on its probabilities.

More ways to use Laya