Guide

What is a decision API? A plain-English guide

A decision API answers typed questions about text with a calibrated probability for each option. What it is, how it differs from prompting an LLM, costs and limits.

Laya Studio6 min read
On this page (9 sections)

Most software makes the same small judgement calls thousands of times a day. Is this support ticket about a refund or about delivery? Is this message angry? Should this intake note go to a nurse or to billing? A decision API is a web service built to answer exactly those questions: you send it some content and a list of typed questions, and it sends back an answer to each one with a probability attached.

This guide explains what a decision API is, how it differs from asking a chatbot, and when it is the right tool. It is written for product managers and ops leads as much as for developers. The technical detail is at the end.

The short answer

A decision API takes two inputs:

  1. A state: the thing you want judged. A customer email, a chat transcript, a form, a JSON record.
  2. Questions: what you want to know about it, each with a fixed set of possible answers.

It returns one answer per question, plus how likely each possible answer is. Nothing else. It does not write a reply, summarise the text, or explain itself in prose.

That constraint is the point. Because the model only ever picks from the answers you allowed, it cannot invent a label that does not exist, and your code never has to parse free text to find out what it decided.

Three kinds of question

Laya, the open-source model behind Laya Studio, supports three question types. Most real decisions fit one of them.

TypeWhat it answersExample
choicePick one option from a list"What is this ticket about?" → refund / tracking / other
scoreRate on an ordered scale"How urgent is this?" → level 0 to 4
noul (yes/no)Is a statement true?"Is the customer angry?" → probability it is true

You can ask several questions about the same message in one request. Laya answers all of them in a single pass through the model, which is why adding a second or third question costs little extra time. For a deeper walk-through, see choice, score and yes/no questions.

Why probabilities matter

Every answer comes back with a probability for each option, for example:

  • refund: 0.95
  • tracking: 0.05
  • other: 0.01

That number lets you decide what to automate. A common pattern:

  • Above 0.9: act automatically (route the ticket, tag the record).
  • Between 0.6 and 0.9: act, but log it for review.
  • Below 0.6: send it to a person.

This only works if the probabilities are calibrated, meaning that answers given at 0.9 are right about 90% of the time. Raw neural networks are often over-confident. Laya's own model card is candid about this: the English checkpoint ships over-confident, and fitting one temperature per question type moves its expected calibration error from 0.466 to 0.081. Laya Studio applies that calibration for you. If you want the maths, read calibrated probabilities and expected calibration error.

Decision API vs. prompting an LLM

Many teams start by asking a large language model to "reply with one word: refund, tracking or other". It works in a demo. At scale, three problems appear.

1. It can answer outside your list. A generative model can write "Refund request", "refund." or an apology. Every variant needs handling. A decision API scores only the options you defined, so an off-list answer is impossible by construction (more on this).

2. It is slow for what it does. Generating text means producing tokens one after another. Laya produces no text: one forward pass answers every question. Measured on a single RTX 4090, one GPU handles roughly 1,000 decisions per second, and a warm single request to Laya Studio takes about 120 ms end to end from Europe.

3. You get no usable confidence. An LLM's "I'm 90% sure" is more generated text, not a measured probability. A decision API's probabilities come straight from the model's output and can be calibrated and checked.

LLMs remain the better tool when you need reasoning, long explanations or open-ended answers. A decision API is for the high-volume, fixed-answer calls in between. The cost trade-off is covered in LLM-as-classifier cost.

What it is good at, and where it is weak

Honest numbers from the Laya model card:

  • Strong: topic classification (AG News, 4 labels: 0.950 accuracy), yes/no entailment in English (XNLI-en: 0.860), spam and phishing detection.
  • Weak: questions with many options. On Banking77, a 77-way banking intent task, Laya scores 0.425, while TypeSafe Jev is reported at 0.870 on a 72-label version. Fine-grained 5-level ratings are also weak (SST-5: 0.372).

The practical rule: keep a single choice question under about 20 options. If you have 70 categories, split them into a coarse question followed by a fine one.

Who uses a decision API?

  • Support and ops teams route tickets, flag urgent or angry messages, and detect refund requests before a human opens the queue.
  • Health-tech and clinical teams triage patient messages and intake notes, where data residency matters as much as speed.
  • Trust and safety teams screen content for spam, phishing or policy breaches.
  • AI agent builders add a fast, predictable gate before calling an expensive model. See decision models for AI agents.

What it costs

Laya Studio charges per input token, like Jev, at $0.0294 per million input tokens (30% below Jev's $0.042 list price). Every new account gets 5 free runs; after that you buy credit packs or pick a monthly plan ($19, $99 or $399). Failed requests are not charged. Details and a cost slider are on the pricing page.

For developers: the request

Laya Studio speaks the same /v1/systemone protocol as TypeSafe Jev, so a Jev client works by changing the base URL and key.

bash
curl https://api.laya.studio/v1/systemone \
  -H "Authorization: Bearer $LAYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "My parcel never arrived and I want my money back.",
    "questions": {
      "intent": {"type": "choice", "instructions": "What does the customer want?", "criteria": {"refund": "wants money back", "tracking": "asks where the parcel is", "other": "anything else"}},
      "angry":  {"type": "noul", "instructions": "The customer is angry."}
    }
  }'

The response contains one entry per question, each with the chosen answer, the probability of every option and a confidence value. The output token count is always zero, because nothing is generated.

FAQ

Is a decision API the same as a text classification API?

It is a kind of classification API, with two differences. You define the labels in each request, so you need no retraining for a new category, and you can ask several differently-typed questions about the same input in one call.

Can a decision API hallucinate?

It cannot return a label you did not offer, because it only scores the options in your request. It can still be wrong, which is why every answer carries a probability you can use as a threshold.

Does it work in languages other than English?

Yes. Laya routes English text to an English model (ModernBERT-large, 421M parameters) and other languages to a multilingual model (mmBERT-base, 322M parameters) covering 100+ languages. The routing is automatic.

How do I try it without writing code?

The Laya Studio homepage shows real answers for five example messages, no account needed. To ask about your own messages, sign up: your first 5 runs are free, in the dashboard playground, processed in Switzerland.

Topics

  • decision API
  • AI classification API
  • calibrated probabilities
  • text classification API
  • LLM alternative for classification

Live demo

Reading is good. Trying is better.

See real answers on five example messages, with a calibrated probability for every answer in about a tenth of a second. Sign up and your first 5 runs on your own messages are free.

Example answer, captured live

Answered in Switzerland

Hi, I was charged twice for order #4821 ($129.00). Please refund the duplicate charge before Friday, our books close then. This is the second billing mistake this quarter and we're starting to look at other vendors.

What does the customer want?

  • refund100%
  • other<0.1%
  • cancel0%
Is it urgent: 17.7%Might they leave: 30.3%

0 words generated · 3 questions in one pass · 354 ms round trip when captured