Decision API quickstart

Laya Studio answers questions about text. You send the text (we call it the state) and a few typed questions; in about 120 ms (a warm request from Europe) you get back an answer to each one, with a probability for every option. It picks from your options instead of writing text, so it can't invent a label.

  • choicePick one label“refund, tracking or other?”
  • scoreRate on a scale“calm … very angry”
  • noulYes or no“Is this urgent?”

Try it first, no code needed

Type a message, add up to four questions and press Run. The JSON and cURL preview updates as you type: that is exactly what your code will send later. The demo is free, needs no account and always runs in Switzerland.

2. Your questions (2/4)

  1. Question 1

    Pick one label from a list.

    Options (3/8)
  2. Question 2

    Yes or no: is this statement true?

3. What gets sent

request bodyjson
{
  "state": "I was charged twice for my order last week. I want my money back today.",
  "questions": {
    "intent": {
      "type": "choice",
      "instructions": "What does the customer want?",
      "criteria": [
        "refund",
        "tracking",
        "other"
      ]
    },
    "angry": {
      "type": "noul",
      "instructions": "Is the customer angry?"
    }
  }
}
No key needed · runs in Switzerland · 12 runs/min

Press Run it free to see each answer with its probabilities.

The demo takes up to 600 characters, 4 questions and 8 options per question. The real API takes up to 32 questions and 64 options; see limits.

For developers: three steps

Happy with the answers? Here is the same thing from your own code.

1. Get a key

Create an account — every workspace starts with 5 free runs (after that, 1 credit = 1 input token). In the dashboard, open API keys and create one. It is shown once; store it as LAYA_API_KEY.

2. Make a call

Base URL https://api.laya.studio. Authenticate with Authorization: Bearer lsk_live_….

cURLbash
curl https://api.laya.studio/v1/systemone \
  -H "Authorization: Bearer lsk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"state":{"message":"I was charged twice this month. Refund me or I cancel."},"questions":{"intent":{"type":"choice","instructions":"What does the customer want?","criteria":{"refund":"money back or a duplicate charge reversed","technical_help":"a bug or integration problem","cancellation":"wants to cancel","other":"anything else"}},"urgent":{"type":"noul","instructions":"Does the message communicate time pressure?"},"frustration":{"type":"score","instructions":"How frustrated does the customer sound?","criteria":["calm","concerned","annoyed","very angry"]}}}'

3. Read the answer

Every question id you sent comes back under answers. Use confidence to decide what to automate and what to send to a person.

200 OKjson
{
  "id": "dec_6f0c…",
  "model": "laya-rl-agent",
  "answers": {
    "intent": {
      "type": "choice",
      "choice": "refund",
      "probabilities": { "refund": 0.9466, "technical_help": 0.0071, "cancellation": 0.0385, "other": 0.0078 },
      "confidence": 0.7899,
      "action": { "act_probability": 1.0 }
    },
    "urgent": { "type": "noul", "noul": 0.81, "confidence": 0.81, "action": { "act_probability": 1.0 } },
    "frustration": {
      "type": "score", "score": 2.31,
      "legend": { "0": "calm", "1": "concerned", "2": "annoyed", "3": "very angry" },
      "probabilities": { "0": 0.03, "1": 0.12, "2": 0.36, "3": 0.49 },
      "confidence": 0.34, "action": { "act_probability": 1.0 }
    }
  },
  "usage": { "input_tokens": 212, "output_tokens": 0 },
  "routing": { "model": "english", "repo": "convaiinnovations/laya", "reason": "English Latin text" }
}
FieldDescription
answers.<id>.choicestringchoice questions: the most probable label.
answers.<id>.scorenumberscore questions: expected level index, Σ i·p(i).
answers.<id>.noulnumbernoul questions: probability that the statement is true.
answers.<id>.probabilitiesobjectThe full distribution over options (choice, score).
answers.<id>.confidencenumberchoice/score: 1 − H(p)/log k. noul: max(p, 1 − p). Gate automation on this.
answers.<id>.action.act_probabilitynumberOutput of the act/escalate head. The model card reports it carries little signal today — prefer confidence.
usage.input_tokensintegerTokens encoded across all questions. output_tokens is always 0.
routingobjectWhich checkpoint answered and why (english / multilingual / typed-decisions).

Next

Learn how to write good questions, handle errors and retries, or switch from Jev. Handling sensitive data? Read Swiss data residency. Everything is in the API reference.