BazaarLinkBazaarLink
เข้าสู่ระบบ
เอกสารAPI ข้อมูลอ้างอิงSDK ข้อมูลอ้างอิงการใช้งาน AgentAI ทักษะ
Decisions

Submit a decisions request

Evaluate a state against named questions with a decisions-output model. This alpha endpoint returns non-streaming JSON. Find available model ids with GET /v1/models?output_modalities=decisions; use this endpoint for Clef instead of chat/completions. Input tokens are billed at the selected model's customer price. Sufficient credits are required. Set BAZAARLINK_API_KEY to your API key; the sample builds its complete Authorization header in BAZAARLINK_AUTH_HEADER.

POST/v1/alpha/decisions

การอนุญาต

Authorizationจำเป็น
string · header

API key เป็น bearer token ใน header Authorization

Body

modelจำเป็น
string

An available decisions-output model id from /v1/models?output_modalities=decisions.

Example: "cloudflare/clef-flash"
stateจำเป็น
JSON string | object | array

The evidence to evaluate, supplied as a string, JSON object, or array. Structured content parts are preserved. Image interpretation depends on the selected model's supported state format; input_tokens includes image tokens when they are counted.

images
string[]

Optional inline images, up to 4 per request: PNG, JPEG or WebP as a data URI or raw base64, each up to 4 MiB and 8 MiB in total. Remote URLs are not accepted. Images are added to the state for the model; input_tokens includes the image tokens. A request with an unsupported or invalid image is rejected with 400 invalid_images.

questionsจำเป็น
record<string, Question>

Named questions. Each answer uses the same question id as its key.

typeจำเป็น
string

noul returns a number for a yes/no decision; choice selects an option; score returns a numeric score.

noulchoicescore
instructionsจำเป็น
JSON string | object | array

Instructions explaining the decision to make.

criteria
record<string, JSON> | JSON[]

Optional true/false guidance for noul. Required option-to-guidance map for choice, with null allowed as option guidance. Required ordered guidance array with at least one item for score.

stream
boolean

Omit this field or set false. Streaming requests are rejected with HTTP 400.

false

คู่มือเชิงลึก →

POST /v1/alpha/decisions
export BAZAARLINK_AUTH_HEADER="Authorization: $(printf '%s %s' 'Bearer' "$BAZAARLINK_API_KEY")"

curl https://api.bazaarlink.ai/v1/alpha/decisions \
  -H "$BAZAARLINK_AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cloudflare/clef-flash",
    "state": "The support agent issued a full refund.",
    "questions": {
      "refunded": {
        "type": "noul",
        "instructions": "Was a refund issued?"
      }
    }
  }'
ตัวอย่างการตอบกลับ

Success. answers contains the typed result for each question. Optional confidence, probabilities and score legend fields depend on the model. usage.input_tokens includes every counted input token; usage.output_tokens reports output tokens. usage.cost is the USD amount charged to the customer. id is an opaque BazaarLink request id and matches x-request-id and x-generation-id. Use this id with GET /v1/generation?id=ID to read back persisted customer usage; retry a 404 briefly while the usage log is written.

{
  "id": "85e6f35c71a31f19-SJC",
  "model": "cloudflare/clef-flash",
  "answers": {
    "refunded": {
      "type": "noul",
      "noul": 0.99
    }
  },
  "usage": {
    "input_tokens": 64,
    "output_tokens": 1,
    "cost": 0.000007
  }
}
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
Submit a decisions request — BazaarLink API