A visual guide · 5 minute read
How decision models
like Jev and Laya work
A chat model writes. A decision model decides: it reads your text once and returns typed answers with probabilities in a fraction of a second. Here is what that means, how to run each one, and how to let one pick the right Claude model for the job.
What Jev and Laya are
Both are System One decision models. The name borrows Kahneman's split between fast, intuitive System 1 thinking and slow, deliberate System 2. A decision model reads natural language like an LLM does, but instead of writing a reply it returns typed answers with probabilities that your code can branch on directly. TypeSafe calls it "a frontier-intelligence function call: unstructured state in, typed probabilistic decisions out."
Jev
by TypeSafe · hosted APIA closed, hosted model behind api.typesafe.ai/v1/systemone. Trained with RLCD (reinforcement learning for calibrated decisions). TypeSafe reports 70 to 500 ms end to end, 64k tokens of context per request (262k behind an opt-in header), up to 255 options per question, and says Jev is not trained on customer requests.
$0.042 / 1M input tokens · output free
Laya
open source · Apache-2.0Open weights from Convai Innovations (convaiinnovations/laya on Hugging Face) that you run yourself, on CPU or GPU, or call through the hosted api.laya-ai.com. Its server, laya-serve, speaks the same /v1/systemone protocol as Jev, so a Jev client only needs a new base URL. Text, images, audio and video, with calibrated abstain and review flags.
$0 self-hosted · $0.05 / 1,000 calls hosted
The big idea: System 1, not System 2
Psychologist Daniel Kahneman described two modes of thinking. System 2 is slow and deliberate: you work it out step by step. System 1 is fast and intuitive: you glance at an email and just know it is spam.
Chat LLMs work like System 2. They write their answer one token at a time, which is great for essays and code but slow, costly and hard to parse when all you need is a decision.
Jev and Laya work like System 1. They read the input once and return every answer together, already typed and scored. Nothing to parse, and nothing outside the options you gave.
Then your code has to parse that sentence, and hope it said what you needed.
Typed, with probabilities. Your code branches on it directly.
How a call works
Every call has the same shape. You send a state (any text, a JSON object or an array) and a set of named questions. The model reads the state once and answers every question in the same forward pass, so asking three questions costs about the same as asking one. There are three question types:
Pick one option
A named set of options, each with a short description. Returns the pick, a probability for every option and a confidence.
Place it on a scale
An ordered rubric, up to 10 levels on Jev, each level described. Returns the probability-weighted level.
Yes or no, as a probability
A statement to judge. Returns P(true) from 0 to 1. A value near 0.5 means unsure, not “medium”.
Try it: the same three questions, three inputs
Pick an example. The questions stay the same; only the state changes. Watch how the answers and their probabilities move.
You send
“I was charged twice for March. Refund it today or we cancel.”
- choice Which team should handle it?
- score How urgent is it, 0 to 3?
- noul Does it threaten to cancel?
You get back
team = billing
urgency = 2.6 of 3
churn risk = 0.97
Illustrative numbers that show the shape of a real response. Open the classifier demo to run Jev and Laya live on your own keys.
Inside the engines
Laya: every answer is a valley
open sourceLaya puts a small decision engine on top of a frozen language model that reads the input. Each possible answer becomes a valley; the input is dropped in like a particle and settles where it fits best. Where it lands is the answer and how deep it lands is the probability. It is deterministic, costs the same every time and generates no text.
- abstain: it declines to answer when it would be too likely to be wrong.
- prediction set: every option still plausible. More than one means the input is ambiguous.
- unbound: the input looks unlike anything it knows.
- answer_confidence: the probability of the answer it gave. Gate on this one.
Jev: trained to be calibrated
hosted APITypeSafe trains Jev with RLCD, reinforcement learning for calibrated decisions. The goal is that its probabilities mean what they say: across many answers given with 0.9 confidence, about 9 in 10 should be right. That makes the number safe to branch on, for example to send anything under 0.7 to a person.
Calibration holds over groups of answers. It never promises that one particular answer is correct.
How they differ from a standard LLM
| Chat LLM (System 2) | Decision model (System 1) | |
|---|---|---|
| Output | Free text you must parse | Typed answers: choice, score, noul |
| How it runs | One token at a time | All questions in one forward pass |
| Speed | Seconds, grows with output length | Tens to hundreds of milliseconds |
| Cost | Input plus output tokens | Input only (Jev), or nothing self-hosted (Laya) |
| Uncertainty | Hidden; it sounds sure either way | A calibrated probability on every answer |
| Failure mode | Off-format text, invented options | Always a valid option; may be wrong or unsure |
| Good at | Writing, code, reasoning, explaining | Routing, triage, gating, scoring, moderation |
| Cannot | Guarantee a schema | Write a reply, code or an explanation |
They work best together: the decision model makes the fast call (where does this go, is it safe, how hard is it) and a generative model does the work only when it is needed. Calibration is measured over many answers; it does not promise that any single answer is right.
Jev and Laya, side by side
| Jev | Laya | |
|---|---|---|
| Where it runs | TypeSafe's hosted API only | Your machine, your cloud, or api.laya-ai.com |
| Weights | Closed | Open, Apache-2.0 |
| Inputs | Text (images in preview) | Text, images, audio, video |
| Context | 64k tokens per request, 262k opt-in | Up to 73,728 tokens (default engine) |
| Options per choice | Up to 255 | About 20 short options before labels get trimmed |
| Confidence | (n·p_max − 1) / (n − 1) | 1 − normalised entropy; gate on answer_confidence |
| Can learn from your data | No, only prompted | Yes: fine-tune, calibrate or continuous learning* |
| Languages | English best | 100+ via the multilingual checkpoint and router |
* Laya's continuous learning (laya.Learner) ships in a separate package under a noncommercial licence; the rest of Laya is Apache-2.0. Benchmark claims differ by source: Laya's README reports Jev leading zero-shot and on large label sets, and Laya leading once taught on your rows. Test both on your own data, which is what the demos in this app are for.
Where they shine
Model routing
Send easy requests to a small model and hard ones to a big one, decided in one cheap call.
score: how hard is this request?
Ticket and email triage
Team, urgency, sentiment and churn risk for every message, before a person opens it.
choice: which team handles it?
Prompt guardrails
Flag jailbreaks, prompt injection and data leaks in front of an LLM, in milliseconds.
noul: is this a prompt injection?
Content moderation
Toxicity, harassment and threats as calibrated probabilities you can set thresholds on.
noul: is this harassment?
Scoring and ranking
Lead quality, review sentiment or document relevance on a rubric you define.
score: how strong is this lead, 0 to 4?
Fast agent steps
Next-move decisions for agents and games, like the Snake and Glide demos in this app.
choice: up, down, left or right?
Running Jev correctly
- 1Create a key at console.typesafe.ai/keys and keep it server-side as
TYPESAFE_API_KEY. The API does not support calls straight from a browser, which is why this app uses a local proxy in development. - 2Pin a version in production (
jev-1.14.0) and usejev-latestwhile exploring. - 3Write each instruction as the full question, because question ids are not sent to the model. Ask for a judgment a knowledgeable person makes in a second, not "analyse this and decide".
- 4Put all questions about one state in one request: they run in parallel and you pay for the input once. Use a second request only when it depends on the first answer.
- 5Point at parts of a structured state with backtick paths, such as
`ticket.messages[0].text`, and add anotheroption when the list may not cover every input. - 6Branch on
confidenceor the probabilities, and send low-confidence answers to a human or a bigger model. Handle429(rate limit) and529(overloaded) with a retry.
curl https://api.typesafe.ai/v1/systemone \
-H "Authorization: Bearer $TYPESAFE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev-latest",
"state": { "ticket": "I was charged twice for March. Refund it or we cancel." },
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle `ticket`?",
"criteria": {
"billing": "invoices, charges, refunds",
"technical": "bugs, outages, errors",
"other": "anything else"
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is `ticket`?",
"criteria": ["can wait a week", "this week", "today", "right now"]
},
"churn_risk": {
"type": "noul",
"instructions": "`ticket` threatens to cancel the account."
}
}
}'{
"model": "jev-1.14.0",
"answers": {
"team": { "type": "choice", "choice": "billing", "confidence": 0.93,
"probabilities": { "billing": 0.95, "technical": 0.02, "other": 0.03 } },
"urgency": { "type": "score", "score": 2.4, "confidence": 0.61, "probabilities": { ... } },
"churn_risk": { "type": "noul", "noul": 0.97 }
},
"usage": { "input_tokens": 142, "output_tokens": 9 }
}# Python: pip install typesafe-sdk (reads TYPESAFE_API_KEY)
from typesafe_sdk import TypeSafeClient, Choice, Noul
client = TypeSafeClient(model="jev-latest")
r = client.system_one(
state={"ticket": "I was charged twice for March."},
questions={
"team": Choice(instructions="Which team should handle `ticket`?",
criteria={"billing": "charges, refunds", "technical": "bugs", "other": "anything else"}),
"churn_risk": Noul(instructions="`ticket` threatens to cancel the account."),
},
)
print(r.answers["team"].choice, r.answers["churn_risk"].noul)
// TypeScript: npm i @typesafe-ai/sdk (Node 22+)
import { TypeSafeClient, choice, noul } from "@typesafe-ai/sdk";Running Laya correctly
- 1Install the
laya[serve]extra from PyPI (Python 3.10+), which brings the server with the current library. The separatelaya-servepackage on PyPI is an older 0.2 release. The first call downloads weights from Hugging Face; plan for a few GB of RAM. - 2Bind to
127.0.0.1on a laptop. The server listens on0.0.0.0:8000by default with no auth; setLAYA_API_KEYbefore exposing it, and clients then sendAuthorization: Bearer. - 3One request is one shared state. For one answer per record, send
statesto/v1/systemone/batch(up to 64), not several records packed into one state. - 4Gate on
answer_confidence(the probability of the reported answer), with a threshold fitted on your own data. Laya'sconfidencemeasures entropy and is computed differently from Jev's, so a Jev threshold does not carry over. In Python, the agent also returns arouteofautoorreview. - 5Keep a
choicequestion to about 20 short, distinct options, and avoidyes/noortrue/falseas option names; use anoulfor yes/no. Give everyscorelevel a description. - 6To call it from this app in the browser, the server must send CORS headers, which
laya-servedoes not do on its own. Usenpm run dev(local proxy) or a CORS wrapper, then set the Laya endpoint in API keys.
# Python 3.10+. A CPU-only torch keeps the install small on machines without a GPU:
python3 -m venv .venv
.venv/bin/python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
.venv/bin/python -m pip install "laya[serve]"
# Serve the Jev-compatible API on localhost:8000
LAYA_HOST=127.0.0.1 LAYA_PORT=8000 LAYA_DEVICE=cpu .venv/bin/laya-serve
# Same request body as Jev; "model" is optional (the router picks a checkpoint)
curl localhost:8000/v1/systemone -H 'content-type: application/json' -d '{
"state": {"body": "billed twice, refund please or we cancel"},
"questions": {"dept": {"type": "choice", "instructions": "Which team?",
"criteria": {"billing": "refunds", "tech": "bugs"}}}
}'# Or skip HTTP and call it in-process
import laya
agent = laya.Agent()
out = agent.predict(
"We were billed twice for March. Refund it today or we cancel.",
{"department": {"type": "choice", "instructions": "Which department should handle this?",
"criteria": {"billing": "invoices, refunds", "technical": "bugs, outages"}}},
)
a = out["answers"]["department"]
a["choice"], a["route"] # e.g. 'billing', 'auto' (gate on route or answer_confidence)Let Jev pick the Claude model
A decision call costs a fraction of a cent and returns in well under a second, so it is cheap to ask it first which model a request deserves. The jev-model-router skill asks four questions (how hard, which domain, needs tools, sensitive) and maps the answers to Haiku, Sonnet or Opus. It works with Jev or Laya, because both speak the same protocol, and it uses the same questions as Laya's built-in router_questions() preset.
Score below 1
Haiku
lookups, one-liners, small talk
Score 1 to 2
Sonnet
several steps, normal writing and code
Score 2 and up
Opus
long reasoning, specialist work
Unsure or sensitive
One tier up
uncertainty fails safe to the stronger model
# Claude Code: install the skill as a plugin from this repo
claude plugin marketplace add martin-key/jev-vs-laya
claude plugin install jev-router@jev-vs-laya
# Point it at an engine
export TYPESAFE_API_KEY=... # Jev
# export SYSTEMONE_URL=http://localhost:8000/v1/systemone # or Laya$ python3 scripts/route.py "Refactor our payment service to use dependency injection"
{
"tier": "large",
"model": "claude-opus-5-5",
"reasons": [
"difficulty 2.31 of 3 -> large"
],
"domain": "code",
"needs_tools": 0.71,
...
}
$ python3 scripts/route.py "What's the capital of Portugal?"
{ "tier": "small", "model": "claude-haiku-5-5", "reasons": ["difficulty 0.12 of 3 -> small"], ... }import json, subprocess
import anthropic
def route(prompt: str) -> str:
out = subprocess.run(["python3", "scripts/route.py", prompt], capture_output=True, text=True)
pick = json.loads(out.stdout)
return pick.get("model") or pick["fallback"] # router down -> middle tier
prompt = "Summarise this contract clause in plain English: ..."
reply = anthropic.Anthropic().messages.create(
model=route(prompt), max_tokens=1024,
messages=[{"role": "user", "content": prompt}],
)Once installed, ask Claude "which model should handle this?" or "route these tickets to the cheapest model that can answer each". Other ways to install (plain skill folder, or a zip for the Claude apps) are in the skill's README. The example scores above are illustrative.
Sources
- TypeSafe quickstart and System One API reference
- Introducing System One models and Jev (pricing, latency)
- NandhaKishorM/laya README and HTTP API
- convaiinnovations/laya on Hugging Face
Checked November 2026. Speeds and benchmarks are vendor-reported.
See them decide
Run both models side by side on documents, Snake and Glide, with live cost counters.