쿠키를 사용합니다. 쿠키와 브라우저 저장소는 로그인 상태를 유지하고 환경설정을 기억합니다. 동의하시면 사이트 이용 방식도 측정합니다. 언제든지 할 수 있습니다. 자세한 내용은 쿠키 정책을 참고하세요.

Decisions

엔드포인트

Decisions

POST /decisions: classify, route and score content with typed questions and probabilities.

플레이그라운드에서 사용해 보기

title: 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

ParameterTypeRequiredDescription
modelstringyesA decision model id, e.g. liquid/d1.
statestring, object or arrayyesThe content to judge: a message, a conversation, a document.
questionsobjectyesNamed questions. Each key is yours and comes back in answers.
providerobjectnoProvider routing preferences.
session_idstringnoGroups related requests.
userstringnoYour end-user id.

Question types

Every question has type, instructions and criteria.

typecriteriaAnswer
choiceObject of option name to guidance.choice (most likely option), confidence, probabilities per option.
noulObject with the keys true and false.noul: the probability of true.
scoreArray 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

StatusCodeWhen
400model_required / invalid_jsonMissing model or malformed body.
402insufficient_balanceYour USD balance is $0.
403model_not_allowedKey allowlist excludes the model.
404model_not_foundUnknown or disabled model id.
429rate_limitedRequests per minute exceeded.

See Errors.