Endpoint
Decisions
POST /decisions: classify, route and score content with typed questions and probabilities.
Coba di playgroundtitle: Decisions description: Classify, route and score content with decision models through POST /decisions on api14. Typed questions in, calibrated probabilities out. keywords: decisions API, /decisions, decision model, classification API, AI scoring API, yes/no probability, routing model, rubric scoring
Decision models read a piece of content (the state) and answer typed questions about it with probabilities instead of free text. Use them for routing, moderation, triage and rubric scoring, where you need a predictable, machine-readable answer.
POST https://api14.com/api/v1/decisions
Decision models do not accept /chat/completions. The official OpenAI SDKs have no decisions method, so call it with plain HTTP or the SDK's generic post (every example below does).
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | A decision model id, e.g. liquid/d1. |
state | string, object or array | yes | The content to judge: a message, a conversation, a document. |
questions | object | yes | Named questions. Each key is yours and comes back in answers. |
provider | object | no | Provider routing preferences. |
session_id | string | no | Groups related requests. |
user | string | no | Your end-user id. |
Question types
Every question has type, instructions and criteria.
type | criteria | Answer |
|---|---|---|
choice | Object of option name to guidance. | choice (most likely option), confidence, probabilities per option. |
noul | Object with the keys true and false. | noul: the probability of true. |
score | Array of ordered levels (at least one). | score (probability-weighted position), confidence, probabilities per level. |
Example
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.post("/decisions", { body: {
"model": "liquid/d1",
"state": "Customer: I was charged twice for my order and want my money back.",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this message?",
"criteria": {
"billing": "Payments, refunds, invoices",
"support": "Product questions and bugs",
"sales": "Pricing and new purchases"
}
},
"urgent": {
"type": "noul",
"instructions": "Does this need a reply today?",
"criteria": {
"true": "Money, outage or legal risk",
"false": "Can wait"
}
}
}
} });
console.log(result.answers);
curl https://api14.com/api/v1/decisions \
-H "Authorization: Bearer sk-api14-..." \
-H "Content-Type: application/json" \
-d '{
"model": "liquid/d1",
"state": "Customer: I was charged twice for my order and want my money back.",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this message?",
"criteria": { "billing": "Payments, refunds, invoices", "support": "Product questions and bugs", "sales": "Pricing and new purchases" }
},
"urgent": {
"type": "noul",
"instructions": "Does this need a reply today?",
"criteria": { "true": "Money, outage or legal risk", "false": "Can wait" }
}
}
}'
Response
{
"id": "gen-dec-1791900000-a1",
"model": "liquid/d1",
"answers": {
"team": { "type": "choice", "choice": "billing", "confidence": 0.93, "probabilities": { "billing": 0.93, "support": 0.05, "sales": 0.02 } },
"urgent": { "type": "noul", "noul": 0.81 }
},
"usage": { "input_tokens": 142, "output_tokens": 0, "cost": 0.0000071 }
}
Log the model string with each answer: an alias such as ~typesafe/jev-latest can point to a newer version later.
Pricing
Decision models are billed per input token at the model's listed price. Output tokens are free. The cost is in usage.cost and debited from your USD balance.
Listing decision models
curl "https://api14.com/api/v1/models?category=decisions"
Errors
| Status | Code | When |
|---|---|---|
| 400 | model_required / invalid_json | Missing model or malformed body. |
| 402 | insufficient_balance | Your USD balance is $0. |
| 403 | model_not_allowed | Key allowlist excludes the model. |
| 404 | model_not_found | Unknown or disabled model id. |
| 429 | rate_limited | Requests per minute exceeded. |
See Errors.