POST /v1/decide

API reference

Bearer laya_ keys. state may be a string or JSON. Choice, score, and noul, plus batch decide, a free confidence gate, and application APIs. Prepaid input tokens; structured output is free.

Authentication

Authorization: Bearer laya_…
Content-Type: application/json

https://laya-model.com

Create keys on Account. Model aliases: english and multilingual.

POST /v1/decide

Alias POST /v1/systemone. A signed-in browser session bills the same balance. Anonymous callers get 1 free run by default (ANON_FREE_RUNS).

curl https://laya-model.com/v1/decide \
  -H "Authorization: Bearer laya_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": {
      "ticket": "I was charged twice and nobody has replied for 3 days.",
      "channel": "email"
    },
    "questions": {
      "route": {
        "type": "choice",
        "instructions": "Where should this go?",
        "criteria": { "billing": "money", "bug": "broken", "account": "login" }
      },
      "urgency": {
        "type": "score",
        "instructions": "How urgent is this?",
        "criteria": ["routine", "today", "urgent"]
      },
      "escalate": { "type": "noul", "instructions": "Escalate to a human now?" }
    }
  }'

Request body

  • state string, object, or array.
  • questions map of ids to noul, choice, or score.
  • Only usage.input_tokens is billed. Structured output is free. A new Google account starts with 10k_monthly (10,000 input tokens each UTC month).

Batch decide

POST /v1/batch/decide: up to 20 states, shared questions. Each state is metered. Same laya_ key.

curl https://laya-model.com/v1/batch/decide \
  -H "Authorization: Bearer laya_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"states":["Passage A","Passage B"],"questions":{"relevant":{"type":"noul","instructions":"Does this answer the question?"}}}'

Confidence gate

POST /v1/gate applies a local policy and returns allow, review, or block. No upstream call, no token burn, and no key required.

curl https://laya-model.com/v1/gate \
  -H "Content-Type: application/json" \
  -d '{"answers":{"toxicity":{"type":"noul","noul":0.12}},"policy":{"min_confidence":0.55}}'

Errors

  • 401 missing or invalid laya_ key, or the anonymous quota is used.
  • 402 insufficient prepaid balance.
  • 429 RPM, or the hourly / daily input-token cap.
  • 503 IMPOSSIBL_API_KEY is not configured.

Application APIs

API reference · Laya AI