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.

A support ticket and three typed questions go into the decision model in one pass. Out come three typed answers: a choice, a score and a yes-or-no probability.state“I was charged twicefor March. Refund itor we cancel.”any text / JSONquestionsteam?urgency?churn?Jev / Layaone forward pass~0.03 to 0.5 s · no text generatedchoicebillingp = 0.95score2.4 of 3urgentnoul0.97P(yes)
01

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 API

A 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.0

Open 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

02

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.

Chat LLM · System 2, writes token by token~2 to 30 s
> Sure! This looks like a billing issue. The customer seems upset and may cancel, so I'd…▍

Then your code has to parse that sentence, and hope it said what you needed.

Decision model · System 1, answers in one pass~0.03 to 0.5 s
team = billing (0.95) · urgency = 2.4 · churn = 0.97

Typed, with probabilities. Your code branches on it directly.

03

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:

choice“Which team should handle this ticket?”

Pick one option

A named set of options, each with a short description. Returns the pick, a probability for every option and a confidence.

score“How urgent is it, 0 to 3?”

Place it on a scale

An ordered rubric, up to 10 levels on Jev, each level described. Returns the probability-weighted level.

noul“Does it threaten to cancel?”

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”.

04

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

billing
0.95
technical
0.02
other
0.03

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.

05

Inside the engines

Laya: every answer is a valley

open source
Each possible answer is a valley. The input is dropped in as a particle, rolls, and settles in the deepest valley, which is the answer. How deep it settles gives the probability.technicalp 0.03billingp 0.95otherp 0.02input dropped in here

Laya 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 API
Calibration: for a well-calibrated model, answers given with confidence 0.9 are right about 90% of the time, so the points sit on the diagonal.confidence the model gavehow often it was rightperfect calibration

TypeSafe 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.

06

How they differ from a standard LLM

Chat LLM (System 2)Decision model (System 1)
OutputFree text you must parseTyped answers: choice, score, noul
How it runsOne token at a timeAll questions in one forward pass
SpeedSeconds, grows with output lengthTens to hundreds of milliseconds
CostInput plus output tokensInput only (Jev), or nothing self-hosted (Laya)
UncertaintyHidden; it sounds sure either wayA calibrated probability on every answer
Failure modeOff-format text, invented optionsAlways a valid option; may be wrong or unsure
Good atWriting, code, reasoning, explainingRouting, triage, gating, scoring, moderation
CannotGuarantee a schemaWrite 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.

07

Jev and Laya, side by side

JevLaya
Where it runsTypeSafe's hosted API onlyYour machine, your cloud, or api.laya-ai.com
WeightsClosedOpen, Apache-2.0
InputsText (images in preview)Text, images, audio, video
Context64k tokens per request, 262k opt-inUp to 73,728 tokens (default engine)
Options per choiceUp to 255About 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 dataNo, only promptedYes: fine-tune, calibrate or continuous learning*
LanguagesEnglish best100+ 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.

08

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?

09

Running Jev correctly

  1. 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.
  2. 2Pin a version in production (jev-1.14.0) and use jev-latest while exploring.
  3. 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".
  4. 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.
  5. 5Point at parts of a structured state with backtick paths, such as `ticket.messages[0].text`, and add an other option when the list may not cover every input.
  6. 6Branch on confidence or the probabilities, and send low-confidence answers to a human or a bigger model. Handle 429 (rate limit) and 529 (overloaded) with a retry.
request · curl
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."
    }
  }
}'
response
{
  "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 }
}
official SDKs
# 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";
10

Running Laya correctly

  1. 1Install the laya[serve] extra from PyPI (Python 3.10+), which brings the server with the current library. The separate laya-serve package on PyPI is an older 0.2 release. The first call downloads weights from Hugging Face; plan for a few GB of RAM.
  2. 2Bind to 127.0.0.1 on a laptop. The server listens on 0.0.0.0:8000 by default with no auth; set LAYA_API_KEY before exposing it, and clients then send Authorization: Bearer.
  3. 3One request is one shared state. For one answer per record, send states to /v1/systemone/batch (up to 64), not several records packed into one state.
  4. 4Gate on answer_confidence (the probability of the reported answer), with a threshold fitted on your own data. Laya's confidence measures entropy and is computed differently from Jev's, so a Jev threshold does not carry over. In Python, the agent also returns a route of auto or review.
  5. 5Keep a choice question to about 20 short, distinct options, and avoid yes/no or true/false as option names; use a noul for yes/no. Give every score level a description.
  6. 6To call it from this app in the browser, the server must send CORS headers, which laya-serve does not do on its own. Use npm run dev (local proxy) or a CORS wrapper, then set the Laya endpoint in API keys.
install and serve
# 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"}}}
}'
python, in-process
# 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)
11

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.

A request goes to Jev, which scores how hard it is in one call. Easy requests go to Haiku, medium ones to Sonnet and hard ones to Opus.request

What's the capital of Portugal?

Jev routerdifficulty 0.1 of 3trivial lookupClaude Haikufast, cheapestClaude SonnetbalancedClaude Opusdeepest reasoning

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

install the skill
# 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
what it returns
$ 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"], ... }
use the pick with the Claude API
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

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.

API keys

Saved in this browser's local storage only. Requests go straight from your browser to each endpoint. Without a key, that engine runs in a clearly labelled simulation.

Jev · TypeSafe
Advanced
Laya