TypeSafe System One
| 方法 | 路径 | 用途 |
|---|---|---|
POST | /v1/systemone | 针对一段内容回答一组带类型的问题(是非概率、单选、评分),返回结构化答案 |
请求体与响应体都按 TypeSafe 官方 System One API,照官方文档写的客户端只需把 Base URL 换成 https://api.modelgo.com、API Key 换成 ModelGo 的 Key。model 填写平台逻辑模型名;模型是否开放本接口以模型广场标注的协议(TypeSafe System One)为准,未开放时返回 400 model_protocol_not_offered。本接口同步返回,不生成文本,也不支持流式。
bash
curl https://api.modelgo.com/v1/systemone \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"state": "这个月的订阅被扣了两次费,请退还多扣的那笔。",
"questions": {
"billing": {
"type": "noul",
"instructions": "这条消息是否与账单有关?"
},
"tone": {
"type": "choice",
"instructions": "这条消息的语气是?",
"criteria": {
"angry": "不满或带敌意",
"calm": "中性或礼貌",
"excited": "热情或急切"
}
},
"urgency": {
"type": "score",
"instructions": "这条消息有多紧急?",
"criteria": ["可以稍后处理", "本周内处理", "今天必须处理"]
}
}
}'请求
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 平台逻辑模型名 |
state | string / object / array | 是 | 所有问题共同针对的内容 |
questions | object | 是 | 问题名 → 问题,至少一个;问题名会原样作为 answers 的键 |
每个问题都要写 type 和 instructions(字符串、对象或数组,说明要判断什么)。官方 API 允许省略 instructions,但本平台当前的服务商要求必填,缺少时返回 400:
type | 含义 | criteria | 答案字段 |
|---|---|---|---|
noul | 是 / 否 | 可选,{"true": …, "false": …} | noul:判断为「是」的概率(0–1) |
choice | 多选一 | 必填,选项名 → 选项描述,1–255 项 | choice、confidence、probabilities |
score | 有序评分 | 必填,1–10 个等级描述组成的数组,下标即分值(从 0 开始) | score(加权期望值,可为小数)、confidence、legend、probabilities |
响应
json
{
"model": "<model>",
"answers": {
"billing": { "type": "noul", "noul": 0.98 },
"tone": {
"type": "choice",
"choice": "calm",
"confidence": 0.7,
"probabilities": { "angry": 0.15, "calm": 0.8, "excited": 0.05 }
},
"urgency": {
"type": "score",
"score": 1.7,
"confidence": 0.55,
"legend": { "0": "可以稍后处理", "1": "本周内处理", "2": "今天必须处理" },
"probabilities": { "0": 0.1, "1": 0.1, "2": 0.8 }
}
},
"usage": { "input_tokens": 277, "output_tokens": 20 }
}model返回你请求时填写的逻辑模型名。- 计费按
usage中的 token 数计量,单价见控制台「模型列表」。 - 缺少
model、state,或questions为空时直接返回400,不会调用上游;问题本身的字段由模型校验,不合法时同样返回 4xx。错误使用平台统一的错误格式(不是官方的detail结构),见错误码与限流。 - 请求里的
stream字段会被忽略,始终同步返回完整 JSON。
暂不支持
- 图片资产
assets与box题型,以及其他需要TypeSafe-Danger-Zone-*请求头的能力(包括长上下文); multipart/form-data请求体,请求体只接受 JSON。