01智能决策

类型化决策模型(System One,兼容 TypeSafe / Jev 客户端协议):输入一段业务状态与若干类型化问题,单次前向返回每题的校准概率——不生成文本,无上下文记忆,每次请求独立。从 Jev / TypeSafe 迁移只需替换 base_url 与 API key。

决策请求
Endpoint POST/v1/systemone
Content-Type application/json
认证 Authorization: Bearer(同其余产品)

请求参数

参数类型必填说明
state任意 JSON是业务状态:字符串或结构化对象/数组(字段名做标签、缩进分层展平为模型输入)
questionsobject是问题集:问题 id → 问题对象(1-32 题),响应 answers 按同键回传
questions.*.typestring是题型三选一:choice(多选一)/ noul(是否判断)/ score(有序等级打分)
questions.*.instructions任意 JSON否问题指令(该问什么)
questions.*.criteria见题型表题型而定choice 必填({选项名: 描述},1-255 项);noul 可选({false: 描述, true: 描述});score 必填([等级描述...],1-10 项,建议至少 2 级)

题型与答案形状

typecriteria 形状answers 响应形状
choice{选项名: 描述},1-255 项{choice: 选中项, confidence: 置信度, probabilities: {选项名: 概率}}
noul可选 {false: 描述, true: 描述}{noul: p(true)}——是否判断,单概率值
score[等级描述...],1-10 项(有序,建议至少 2 级){score: 期望等级, legend: 等级表, probabilities: {"0": 概率, ...}, confidence: 置信度}
shell
curl https://www.suanlinfang.cn/v1/systemone \
  -H "Authorization: Bearer nk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "订单 20261030-5867 延迟三天送达,外包装压坏,付款还被重复扣了两次。",
    "questions": {
      "team":   {"type": "choice", "instructions": "这条工单该转给哪个团队?",
                 "criteria": {"退换货": "退换、退款", "配送": "延迟、物流损坏", "账务": "重复扣款、支付问题"}},
      "urgent": {"type": "noul", "instructions": "需要人工紧急介入吗?"}
    }
  }'
python
import requests

resp = requests.post(
    "https://www.suanlinfang.cn/v1/systemone",
    headers={"Authorization": "Bearer nk-your-api-key"},
    json={
        "state": "订单 20261030-5867 延迟三天送达,外包装压坏,付款还被重复扣了两次。",
        "questions": {
            "team": {"type": "choice", "instructions": "这条工单该转给哪个团队?",
                     "criteria": {"退换货": "退换、退款", "配送": "延迟、物流损坏", "账务": "重复扣款、支付问题"}},
            "urgent": {"type": "noul", "instructions": "需要人工紧急介入吗?"},
        },
    },
    timeout=60,
)
resp.raise_for_status()
print(resp.json()["answers"])

响应体

{
  "inferenceId": "5f2b8c3a-9d41-4e7a-b6f2-1c8d3a9e0b47",
  "answers": {
    "team":   {"type": "choice", "choice": "账务", "confidence": 0.86,
               "probabilities": {"退换货": 0.05, "配送": 0.09, "账务": 0.86}},
    "urgent": {"type": "noul", "noul": 0.73}
  },
  "usage": {"input_tokens": 214, "output_tokens": 0},
  "latency_ms": 37
}

概率保留 4 位小数。

02历史记录查询

查询本 API Key 所属账户的智能决策调用历史;鉴权同产品端点(Bearer API Key),响应为分页 JSON(无信封)。

单笔历史

Endpoint GET/v1/decision/records

分页查询智能决策单笔形态的历史。

Query 参数

参数类型必填说明
pageinteger否页码,默认 1
pageSizeinteger否每页条数,默认 10

响应字段(items[] 内,null 字段不下发)

字段类型说明
formstringsingle(决策为单笔同步产品)
statusstringprocessing / success / failed
inputCountinteger计费输入 token(输出免费,无输出计量)
consumerCostnumber本笔消费金额(元)
elapsedMsinteger推理耗时(毫秒)
errorMsgstring失败原因(成功为 null 不下发)
createdAt / completedAtstring受理 / 完成时间;两者之差即处理耗时
inputTextstring完整输入(state+questions 请求体 JSON)
resultTextstring判断结论(answers JSON;失败 / 处理中不下发)

响应示例

json · response
{
  "total": 42, "page": 1, "pageSize": 10,
  "items": [{
    "form": "single", "status": "success",
    "inputCount": 52, "consumerCost": 0.0104,
    "createdAt": "2026-10-29T10:00:00", "completedAt": "2026-10-29T10:00:08"
  }]
}
03计费说明

按笔后付费:每次成功调用按实际用量从账户余额扣费,失败调用不扣费。费用明细与账户余额可在「智能决策工具」页的「历史记录」与「账户信息」页查看。

按 token 计价,元 / 百万 token:按 usage.input_tokens(状态 + 全部问题展开的 token 数)计费,输出免费——output_tokens 仅为协议兼容字段,恒不计费。牌价以平台实时牌价为准。

请求无上下文记忆:同一 state 重复提交按新请求计费,相同状态可并发复用。网络中断可能发生在计费完成之后,重试同一请求会产生新的计费,请结合「调用记录」核对后再重试。