Choose a model
laya-english for English short text or laya-multilingual for multilingual input.
HOSTED MODEL · DEVELOPER API
Ask a focused question about a message and get an answer your application can use. The Laya API returns a label, a yes probability, or an ordered score instead of chat prose.
Use the English or multilingual Laya model. Requests run on the same hosted service as the playground.
Illustration only. Run the request for live probabilities.
START WITH YOUR CODING AGENT
Paste this into the agent working on your app. It includes the endpoint, request shape, model limits and key handling rules without a secret.
Integrate the Laya AI short-text decision API into this project. Inspect the existing stack and choose a server-side integration point that fits its conventions.
API contract:
- POST https://laya-ai.pro/api/v1/systemone with Authorization: Bearer $LAYA_AI_API_KEY and Content-Type: application/json. Use a Laya AI key from https://laya-ai.pro/api-guide#keys; a Jev AI key is not interchangeable.
- Start with model "laya-english" for English text, or "laya-multilingual" for multilingual text. Confirm connected models with authenticated GET https://laya-ai.pro/api/v1/models before offering model selection.
- Example body: {"model":"laya-english","state":"Checkout fails after I enter my card. I need this order today.","questions":{"urgent":{"type":"noul","instructions":"Does the customer mention a time-sensitive need?"}}}.
- Read the yes probability from "answers.urgent.noul" (0–1). For labels or ordered levels, use "choice" or "score" and read their response shapes at https://laya-ai.pro/docs.
- Keep each question within the model's total token budget, including the state, instructions and labels: 512 for laya-english and 1,024 for laya-multilingual. The API rejects oversized input with 422.
Keep LAYA_AI_API_KEY in a server-only environment variable. Never put it in browser code, logs, commits or a chat message. Tell me exactly where to configure it locally and in deployment; do not ask me to paste the secret here.
Implement the request, typed response handling and useful errors for 401, 402, 422, 429 and 502/503/504. Respect Retry-After for 429, and do not automatically retry a POST when its outcome is uncertain. Add focused tests using a mocked API response. When the key is configured, show me how to make one minimal live call and verify the returned answers and usage.Next, create a Laya AI key and add it to your server environment as LAYA_AI_API_KEY. Keep the key out of agent chat.
ONE REQUEST, TYPED ANSWERS
Send model, state, and named questions to POST /api/v1/systemone. The response includes answer values, probabilities, the selected model, and token usage.
laya-english for English short text or laya-multilingual for multilingual input.
Use choice for a label, noul for a yes probability, or score for ordered levels.
Route a ticket or flag it for review using the structured answer. Inspect probabilities before automating a sensitive step.
FIRST CALL
Create a key below, keep it on your server, and send this request. The example uses the same support case as the homepage.
printf 'Paste your Laya AI API key (input hidden): '
read -rs LAYA_AI_API_KEY
printf '\n'
curl https://laya-ai.pro/api/v1/systemone \
-H "Authorization: Bearer $LAYA_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"laya-english","state":"Checkout fails after I enter my card. I need this order today.","questions":{"team":{"type":"choice","instructions":"Which team should handle this message?","criteria":{"billing":null,"engineering":null,"support":null}},"urgent":{"type":"noul","instructions":"Does the customer mention a time-sensitive need?"}}}'
unset LAYA_AI_API_KEYNeed more room? The same key and request also run jev-latest (64k tokens) and mercury-decide (32,768 tokens). Choose a model →
The per-question budget includes the text, instructions, and labels. Oversized input is rejected rather than silently shortened. Read the full API guide →
READY TO BUILD
Create and manage keys in the API guide, then use one from your server to make a request.
New eligible accounts receive 20 welcome credits. API calls use purchased input tokens first, then one credit per successful request when tokens are insufficient. See plans and billing details →