Skip to content
Laya AI

Unofficial community documentation

API reference

Instant laya_ keys. Core decide accepts string or structured JSON state — Choice / Score / Noul. Plus batch decide, a free confidence gate, and ready-made application APIs. Prepaid input tokens; output free.

Disclaimer

Unofficial community API gateway. Inference is proxied to a third-party host (Impossibl) by default. Not affiliated with Convai Innovations, TypeSafe, or Impossibl. Hosted latency is not the README T4 figure.

Product shape mirrors unofficial hosts like jevtypesafe.org API docs, but inference runs Laya (not Jev). Upstream provider keys stay on our servers.

Authentication

Create keys on Account after buying a prepaid pack (or using monthly free tokens).

headers
Authorization: Bearer laya_your_key_here
Content-Type: application/json
text
https://api.layaaimodel.com

Core API — /v1/decide

Also available as /v1/systemone (same body). Models: convaiinnovations/laya (default) or convaiinnovations/laya-multilingual.

bash
curl https://api.layaaimodel.com/v1/decide \
  -H "Authorization: Bearer laya_YOUR_KEY_HERE" \
  -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", "critical"]
      },
      "escalate": {
        "type": "noul",
        "instructions": "Escalate to a human now?"
      }
    }
  }'
python
import os, requests

resp = requests.post(
    "https://api.layaaimodel.com/v1/decide",
    headers={"Authorization": f"Bearer {os.environ['LAYA_API_KEY']}"},
    json={
        "state": "Customer: I was charged twice and nobody has replied for 3 days.",
        "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", "critical"],
            },
            "escalate": {"type": "noul", "instructions": "Escalate to a human now?"},
        },
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
typescript
const res = await fetch("https://api.layaaimodel.com/v1/decide", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LAYA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    state: "Customer: I was charged twice and nobody has replied for 3 days.",
    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", "critical"],
      },
      escalate: { type: "noul", instructions: "Escalate to a human now?" },
    },
  }),
});
if (!res.ok) throw new Error(await res.text());
console.log(await res.json());

Request body

  • state — string, object, or array
  • questions — map of ids → noul | choice | score
  • usage.input_tokens is deducted from prepaid balance; output is free

Batch decide — /v1/batch/decide

Same questions, many states (up to 20). One auth header; prepaid settlement per state.

bash
curl https://api.layaaimodel.com/v1/batch/decide \
  -H "Authorization: Bearer laya_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "states": ["Passage A…", "Passage B…"],
    "questions": {
      "relevant": {
        "type": "noul",
        "instructions": "Does this passage answer: How do I rotate my API key?"
      }
    }
  }'

Confidence gate — /v1/gate

No upstream call and no token burn. Returns allow | review | block.

bash
curl https://api.layaaimodel.com/v1/gate \
  -H "Authorization: Bearer laya_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "answers": {
      "action": { "type": "choice", "choice": "allow", "confidence": 0.91 },
      "toxicity": { "type": "noul", "noul": 0.12 }
    },
    "policy": {
      "min_confidence": 0.55,
      "noul": { "toxicity": { "block_above": 0.85, "review_above": 0.4 } },
      "choice": { "action": { "allow": ["allow"], "block": ["block"], "review": ["review"] } }
    }
  }'

Errors & limits

  • Rate limit starts ≈ 60/min; higher RPM on Staging+ packs (up to 240).
  • Soft burn caps ≈ 5,000,000 tokens/hour and 80,000,000 tokens/day per account.
  • Anonymous tools: 5 free runs/IP. Registered: ~10k free input tokens/month.
  • Prefer many questions in one /v1/decide; use batch for many states.

Ready-made application APIs

Fixed templates — same Bearer key and prepaid metering. Try them on /tools/ (paste your key to consume balance).

  • POST /v1/email/triage
  • POST /v1/support/triage
  • POST /v1/content/moderate
  • POST /v1/leads/qualify
  • POST /v1/agent/risk
  • POST /v1/prompt/guard
  • POST /v1/model/route
  • POST /v1/social/post-analyze
  • POST /v1/rag/relevance
  • POST /v1/scam/spot
  • POST /v1/pr/risk
  • POST /v1/content/classify
  • POST /v1/context/filter
  • POST /v1/ads/analyze
  • POST /v1/seo/page-relevance
  • POST /v1/app/review
  • POST /v1/review/fake

Next steps

Buy packs on Pricing. Monitor usage on Account. Gateway health: Status.