Skip to content
SONOEDocs
EspañolESConsole

POST /v1/decide

Sonoe's native endpoint. It runs the same model as /v1/systemone, with Sonoe's own question names and two extras: every answer says whether to abstain, and you can set the confidence threshold for it.

POSThttps://api.sonoeai.com/v1/decide

Request body

statestring | object | arrayrequired
What to decide about. See State.
questionsmap<string, Question>required

1 to 64 questions, under keys you choose.

type"choice" | "scale" | "binary"required
askstringrequired
The question, up to 2,000 characters.
optionsmap<string, string | null>optional
choice only, required: 2 to 256 options, each with a description or null.
levelsarray<string>optional
scale only, required: 2 to 10 distinct levels, lowest to highest.
min_confidencenumberoptional
Abstain below this confidence (0 to 1) for this question.
min_confidencenumber | nulloptional
Abstain below this confidence for every question that doesn't set its own. If neither is set, the model's calibrated default for each type applies. See Confidence.
{
  "state": { "channel": "chat", "message": "My card was charged twice and I want my money back" },
  "questions": {
    "team": {
      "type": "choice",
      "ask": "Which team should handle this?",
      "options": { "billing": "Payments, charges, refunds", "shipping": "Deliveries", "sales": null }
    },
    "urgency": { "type": "scale", "ask": "How urgent is it?", "levels": ["low", "medium", "high"] },
    "refund": { "type": "binary", "ask": "Does the customer ask for a refund?" }
  }
}

Response

modelstringrequired
The model that answered.
answersmap<string, Answer>required
type"choice" | "scale" | "binary"required
answerstring | booleanrequired
The chosen option or level; for binary, true when the probability of yes is at least 0.5.
probabilitiesmap<string, number>optional
choice and scale: each option or level and its probability.
probabilitynumberoptional
binary: the probability of yes.
valuenumberoptional
scale: the expected level (0 = lowest), can land between two.
confidencenumberrequired
From 0 to 1.
abstainbooleanrequired
true when the confidence is below the threshold: don't act on this answer on its own.
msnumberrequired
Time the model took, in milliseconds.
usageobjectrequired
tokensintegerrequired
Tokens read (and charged) for this request.
tokens_este_mesintegerrequired
Tokens used this month, including this request.
cuota_mensualintegerrequired
Your monthly quota.
{
  "model": "sonoe-1.1.0",
  "answers": {
    "team": {
      "type": "choice",
      "answer": "billing",
      "probabilities": { "billing": 0.9957, "shipping": 0.0017, "sales": 0.0026 },
      "confidence": 0.9721,
      "abstain": false
    },
    "urgency": {
      "type": "scale",
      "answer": "medium",
      "value": 1.05,
      "probabilities": { "low": 0.2543, "medium": 0.4413, "high": 0.3044 },
      "confidence": 0.0249,
      "abstain": true
    },
    "refund": { "type": "binary", "answer": true, "probability": 0.9753, "confidence": 0.8328, "abstain": false }
  },
  "ms": 59.0,
  "usage": { "tokens": 350, "tokens_este_mes": 2707, "cuota_mensual": 1000000 }
}

Compared with /v1/systemone

/v1/systemone/v1/decide
noul → noulbinary → answer, probability, confidence, abstain
choice with criteria → choicechoice with options → answer
score with criteria → score, legendscale with levels → value, answer
instructions (string, object or array, optional)ask (string, required)
No abstentionabstain, min_confidence
usage.input_tokensusage.tokens, plus this month's total and your quota

Validation errors use FastAPI's shape: 422 with detail as a list of { loc, msg, type }. Other errors have detail and error, as in Errors and limits.

Example

curl https://api.sonoeai.com/v1/decide \
  -H "Authorization: Bearer $SONOE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"state":"the thing","questions":{"department":{"type":"choice","ask":"Which department?","options":{"billing":null,"shipping":null,"sales":null}}},"min_confidence":0.5}'