Laya API

System One, as a hosted API

Typed decisions in one forward pass.

Sign in with Google, mint an API key, and send state plus choice / score / noul questions. The engine returns structured answers your code can branch on — the same shape as TypeSafe Jev, running Laya.

1. Sign in

Google OAuth creates your account. Locally you can use the dev login when ALLOW_DEV_LOGIN=true.

2. Create a key

Keys are shown once, stored as SHA-256 hashes in Postgres, and sent as Authorization: Bearer.

3. Query the engine

POST /v1/systemone evaluates every question in one pass. Default model laya-latest routes to the right checkpoint.

Example POST /v1/systemone
curl -s $PUBLIC_BASE_URL/v1/systemone \
  -H "Authorization: Bearer $LAYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "Duplicate charge on invoice #4411. Refund today or we cancel.",
    "model": "laya-latest",
    "questions": {
      "department": {
        "type": "choice",
        "instructions": "Which team should handle this?",
        "criteria": {
          "billing": "invoices, payments, refunds",
          "technical": "bugs, outages, integrations",
          "sales": "pricing, new contracts"
        }
      },
      "is_urgent": {
        "type": "noul",
        "instructions": "Does this convey urgency?"
      }
    }
  }'