Decisions

POSThttps://api.oneinfer.ai/v1/ula/decisions

Run structured decisions over arbitrary state and return typed Noul, Choice, and Score answers in a single request. Decision models come from TypeSafe, Respan, Upstage, Together, Cloudflare and Nace.AI; name the model and OneInfer picks the provider. Each question in the request can be one of three types — mix them freely per call.

Request headers

Authorizationstringrequired
Bearer token for authentication. Format: Bearer <YOUR_TOKEN>. Exchange your API key for a token via the Authentication endpoint.
Content-Typestringrequired
Set to application/json for all decisions requests.

Request parameters

modelstringrequired
Decisions model name. Recommended: typesafe/jev-1.13. Use the GET Models endpoint to enumerate available decision models.
stateobjectrequired
The input the model decides over. Accepts a plain string, an object, or an array — anything the model can index against.
questionsobjectrequired
A non-empty map of question name → question spec. Each entry has a type discriminator of noul, choice, or score (see Question Types below). Names must be non-empty strings.
providerobject
Optional routing hints (e.g. {"allow_fallbacks": true}), for TypeSafe, Respan and Upstage models only. Together's, Cloudflare's and Nace.AI's decision models refuse it with a 400.
session_idstring
Optional session identifier (≤ 256 chars) for grouping related decisions requests across calls.
traceobject
Optional trace metadata (e.g. {"trace_id": "..."}), for TypeSafe, Respan and Upstage models only; the other decision models refuse it with a 400.
userstring
Optional end-user identifier (≤ 256 chars) for billing or abuse tracing.

Question types

noulboolean confidence

Returns a probability between 0 and 1 in the answer's noul field. Criteria must define exactly the keys true and false, each describing the matching label.

JSON
"is_bug": {
  "type": "noul",
  "instructions": "Is this a bug?",
  "criteria": {
    "true":  "Broken behavior",
    "false": "Not broken"
  }
}
choicesingle label

Returns the chosen key in the answer's choice field. Criteria is a map of key → label with at least two entries; every name and label must be non-empty.

JSON
"team": {
  "type": "choice",
  "instructions": "Who owns it?",
  "criteria": {
    "payments": "Payment issue",
    "frontend": "Rendering issue"
  }
}
scorerank

Returns the index of the selected option in the answer's score field. criteria is an ordered array of two or more non-empty labels; lower index = ranked higher.

JSON
"urgency": {
  "type": "score",
  "instructions": "How urgent?",
  "criteria": ["Can wait", "Blocking revenue"]
}

Example request

POST {BASE_URL}/v1/ula/decisions
{
  "model": "typesafe/jev-1.13",
  "state": { "ticket": "Checkout is broken" },
  "questions": {
    "is_bug": {
      "type": "noul",
      "instructions": "Is this a bug?",
      "criteria": { "true": "Broken behavior", "false": "Not broken" }
    },
    "team": {
      "type": "choice",
      "instructions": "Who owns it?",
      "criteria": { "payments": "Payment issue", "frontend": "Rendering issue" }
    },
    "urgency": {
      "type": "score",
      "instructions": "How urgent?",
      "criteria": ["Can wait", "Blocking revenue"]
    }
  },
  "provider": { "allow_fallbacks": true },
  "session_id": "triage-2024-q4",
  "user": "support-bot"
}

Response

JSON
{
  "api_details": {
    "api_status": "success",
    "api_message": "API has returned response successfully."
  },
  "data": {
    "id": "dec_abc123",
    "model": "typesafe/jev-1.13",
    "provider": "TypeSafe",
    "answers": {
      "is_bug":  { "type": "noul",   "noul":   0.96 },
      "team":    { "type": "choice", "choice": "payments" },
      "urgency": { "type": "score",  "score":  1 }
    },
    "usage": {
      "input_tokens":  476,
      "output_tokens": 70,
      "cost":          0.000019992,
      "credits_used":  0.0019992
    },
    "latency_ms": 1820
  },
  "error": {}
}

Error status codes

CodeStatusDescription
200OKDecisions returned successfully.
400Bad RequestInvalid request body, unknown question type, or missing pricing for the chosen model.
401UnauthorizedMissing or invalid Authorization header / Bearer token.
403ForbiddenInsufficient credit balance.
422Unprocessable EntityRequest body failed schema validation.
429Too Many RequestsUpstream provider rate limit reached.
500Internal Server ErrorUnexpected error during decision processing.
503Service UnavailableDecision model is temporarily unavailable.
504Gateway TimeoutUpstream provider timed out.

Response

202 - application/json