参考
Jev API Docs
本站 Jev 决策接口的参考文档。Jev 是 TypeSafe AI 的 System One 模型;本站是托管其访问的独立 API 服务。发送一段状态和一组问题,即可得到每个问题的类型化答案。
更新于
接口
向本站发送 POST /api/v1/decisions。没有 chat-completions 路径,也没有流式响应。GET /api/v1/models 列出模型 id。
POST https://jev-api.org/api/v1/decisions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json鉴权
把控制台密钥放在 Authorization: Bearer。缺失或被拒绝的密钥返回 401。试用台在你运行请求时,会为已登录账号创建密钥。
快速开始
把 JEV_API_KEY 设为控制台里的密钥,然后发送下面的请求。新账号有 2 积分,够 2 次成功调用。
curl https://jev-api.org/api/v1/decisions \
-H "Authorization: Bearer $JEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev-1.13",
"state": "Thanks for the refund. Still annoyed it took three emails.",
"questions": {
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of this message?",
"criteria": {
"positive": "Satisfied or thankful overall.",
"mixed": "Both satisfied and unhappy.",
"negative": "Unhappy overall."
}
},
"needs_follow_up": {
"type": "noul",
"instructions": "Should a person reply to this message?"
}
}
}'请求体
model 为 jev-1.13 或 jev-latest。state 是字符串、JSON 对象或文本数组,最多 60,000 字符。questions 是 1 到 6 个 snake_case id 的映射。id 只是答案返回时的标签,不是问题本身。真正的问题写在 instructions,为 1 到 2,000 字符的文本。
{
"model": "jev-1.13",
"state": "Thanks for the refund. Still annoyed it took three emails.",
"questions": {
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of this message?",
"criteria": {
"positive": "Satisfied or thankful overall.",
"mixed": "Both satisfied and unhappy.",
"negative": "Unhappy overall."
}
},
"needs_follow_up": {
"type": "noul",
"instructions": "Should a person reply to this message?"
}
}
}问题类型
Noul
type 为 noul 时只需要 instructions。答案字段 noul 是陈述为真的概率,从 0 到 1。没有单独的 confidence 字段。如果你在 noul 问题上发送 criteria,本接口会忽略它。
Choice
type 为 choice 时需要 instructions 和 criteria:2 到 8 个 snake_case 选项 id,各映射到最多 300 字符的说明。答案包含 choice、每个选项的 probabilities,以及 confidence。
Score
type 为 score 时需要 instructions,以及从低到高排列的 2 到 10 条档位说明。答案包含 score、你的档位 legend、probabilities 和 confidence。
响应
成功的响应体包含 model、以你的问题 id 为键的 answers、含 input_tokens 和 output_tokens 的 usage,以及 credits_used。即使发送 jev-latest,model 也报告 jev-1.13。下面是快速开始请求的示例响应,已省略 usage。
{
"model": "jev-1.13",
"answers": {
"sentiment": {
"type": "choice",
"choice": "mixed",
"probabilities": { "mixed": 0.79, "negative": 0.2, "positive": 0.01 },
"confidence": 0.61
},
"needs_follow_up": { "type": "noul", "noul": 0.83 }
},
"credits_used": 1
}读懂概率和 confidence
Noul 是 instructions 中陈述为真的概率。Choice 和 Score 返回每个选项或档位的概率,外加 confidence。
第二名就是转人工的信号。当 confidence 低,或两个选项接近时,把这种情况交给人,或再问一个更具体的问题。看过这些接近的结果之前,不要调低截止值。
限制
| 项目 | 本接口 |
|---|---|
| 接口 | POST /api/v1/decisions,Bearer 密钥 |
| 模型 | jev-1.13(jev-latest 是别名) |
| 每次调用的问题数 | 1 到 6 |
| Choice 选项数 | 2 到 8 |
| Score 档位数 | 2 到 10,最低档在前 |
| State | 字符串、JSON 对象或数组,最多 60,000 字符 |
| Instructions | 文本,1 到 2,000 字符 |
| 计费 | 每次成功调用 1 积分;失败调用免费 |
| 流式输出 | 不支持 |
与 TypeSafe API 的差异
TypeSafe AI 在 POST https://api.typesafe.ai/v1/systemone 提供 Jev,使用 TypeSafe 密钥,按输入 token 计费。这里的请求体结构相同:model、state 和 noul、choice 或 score 类型的 questions。变化的是:
- 路径和密钥:jev-api.org 上的 POST /api/v1/decisions,密钥来自本站控制台。TypeSafe 密钥在这里无效,本站密钥也不能用在 TypeSafe 上。
- 模型 id:发送 jev-1.13 或 jev-latest。jev-1.13.0 这类带版本号的 id 会返回 422。
- 限制:每次调用 1 到 6 个问题、2 到 8 个 Choice 选项。TypeSafe 文档允许最多 255 个 Choice 选项。
- 字段:instructions 必须是文本,每个 Choice 选项需要说明。TypeSafe 还接受对象或数组形式的 instructions,以及为 null 的选项说明。
- 计费:每次成功调用 1 积分,无论 token 数。
错误
- 401 — 缺少或被拒绝的 API 密钥。
- 402 — 密钥有效,但余额不够这次调用。上游失败不会扣积分。
- 422 — 请求体校验失败。消息会指出字段。
- 429 — 决策服务被限流。稍后再试。
- 502 — 决策服务没有返回答案。不扣积分。
模型 id
本 API 提供 jev-1.13。代码里的阈值依赖同一套概率分布时,发送这个 id。在本 API 上,jev-latest 是同一 id 的别名。