laya-serve
Jev-compatible HTTP server for Laya
System One decision models. Point any Jev client at this server and get typed
choice / score / noul answers from local Laya weights instead of the
TypeSafe API.
Quickstart
pip install "laya-serve[inference]"
LAYA_SERVE_BACKEND=laya LAYA_SERVE_PRELOAD=true laya-serve
curl -X POST localhost:8000/v1/systemone \
-H "Content-Type: application/json" -d '{
"state": "Help! My payouts have been failing for 3 days.",
"model": "jev-latest",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, invoicing, refunds",
"technical": "Bugs, outages, integrations",
"sales": "Pricing, upgrades, new accounts"
}
},
"is_urgent": {"type": "noul", "instructions": "The message conveys urgency?"}
}
}'
Without weights (API development, CI):
pip install -e ".[test]"
LAYA_SERVE_BACKEND=fake laya-serve # deterministic uniform answers
Endpoints
| Method | Path | Notes |
|---|---|---|
POST |
/v1/systemone |
Jev-compatible evaluation endpoint |
GET |
/v1/models |
Serving model + accepted aliases |
GET |
/healthz |
Liveness probe (not part of the Jev API) |
Errors use {"error": {"message", "field"}} with Jev status codes
(401 bad key, 422 validation, plus 429/529 reserved for future
rate-limit/overload handling).
Configuration (LAYA_SERVE_ env prefix)
| Variable | Default | Meaning |
|---|---|---|
LAYA_SERVE_BACKEND |
fake |
laya (real weights) or fake (weight-free) |
LAYA_SERVE_SERVING_MODEL |
laya-english |
Id reported in the model response field |
LAYA_SERVE_EXTRA_MODELS |
`` | Extra accepted model names, comma-separated |
LAYA_SERVE_DEVICE |
auto | Passed to the Laya Router (cuda, cpu, …) |
LAYA_SERVE_MAX_LOADED |
1 |
Router LRU cap on resident checkpoints |
LAYA_SERVE_PRELOAD |
false |
Preload all checkpoints (recommended for servers) |
LAYA_SERVE_API_KEY |
unset | When set, requires Authorization: Bearer <key> |
Accepted model names out of the box: jev-latest, jev-preview,
jev-1.13.0, jev-1.13, laya, laya-latest, plus the serving model id
itself. Anything else is a 422 (fail fast on typos, like Jev).
Jev compatibility notes
Verified against docs.typesafe.ai and laya 0.3.x source. Deliberate,
documented divergences:
- Laya-only fields are stripped:
actionon every answer, andconfidenceonnoulanswers. Responses contain exactly the Jev fields. modelechoes the serving checkpoint (e.g.laya-english), the same way Jev echoes the resolved version id (jev-1.13.0).output_tokensis0. Laya never generates tokens; this layer does not invent counts.input_tokensis the backend's token count.- Confidence formula differs: Laya uses entropy-based
1 - H(p)/log(k); Jev documents a peak-based normalization. Same probabilities can yield differentconfidencevalues — calibrate thresholds against Laya, not Jev. - Validation: choice ≤ 255 options, score 2–10 levels,
modelrequired, non-emptyquestions— all422. Context budgets are the checkpoint's own (max_len/head_max_len); oversized option sets surface as422, not Jev's 64k/32k accounting. - Score
legend/probabilitieskeys are strings on the wire ({"0": …}), matching Jev HTTP. choicecriteria as a list is accepted leniently (mapped to{label: None}); Jev requires a map.
Development
python -m venv .venv && .venv/bin/pip install -e ".[test]"
.venv/bin/python -m pytest -q
Or with uv (reproducible, via uv.lock):
uv sync --extra test
uv run pytest -q
Lint/format via ruff and hooks via pre-commit:
uvx ruff check src tests && uvx ruff format --check src tests
pre-commit install && pre-commit run --all-files
License
Apache-2.0 — see LICENSE.
Release files for laya-serve 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| laya_serve-0.1.0.tar.gz | 20.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| laya_serve-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / laya_serve-0.1.0.tar.gz
| Download URL | laya_serve-0.1.0.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a566b4d68aaf008d43edf1bde68b243e5425b3fbb2b374270d204a706055017
|
|
BLAKE2b-256 checksum How to use checksums |
1b8022ad993fb138cae474e5cb9f73a2b40a28f25196be5276dca0721c71c2ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / laya_serve-0.1.0-py3-none-any.whl
| Download URL | laya_serve-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98b731b91e70094c7ad440d49ec5d7f6ddeb1491b2ec2134355b106c88c247a9
|
|
BLAKE2b-256 checksum How to use checksums |
bb8374e7358320020c4a69d34c395c8d9fcf8600dcd47c995839e9a1042d5297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log