接口
OpenRouter
本站 Playground 通过 OpenRouter 调用固定版本的 Jev。当前价格和可用性请以模型页面为准。
- 接口
- POST https://openrouter.ai/api/alpha/decisions
- model
- typesafe/jev-1.13
- API 密钥
- 在服务端用 Bearer token 发送 API 密钥。
选择一个问题,或针对同一情境提出三个不同问题。先选案例,再修改输入,查看每个问题的结构化回答。
每次专注测试一种回答类型。 每次运行消耗一次每日体验额度。
运行案例后,每个问题都会返回一份结构化答案:Choice 选择选项,Score 给出分数,Probability 返回 0 到 1 之间的数值。
表单会将文本作为 state.input,并发送一个或三个命名问题。每个结果都可在 answers.<question_id> 下找到。
请求里定义要判断的问题,响应会按问题名称返回结果。下面解释示例中用到的 JSON 字段。
modelstatequestions<question_id>typeinstructionscriteriaanswerschoiceprobabilitiesconfidencescorelegendnoul同一份上下文,分别测试 Choice、Score 和 Probability 三个问题。 每次运行消耗一次每日体验额度。 结果符合字段格式,也可能判断错误。请用自己的样本验证,并按业务风险设置分流阈值。
本站 Playground 通过 OpenRouter 调用固定版本的 Jev。当前价格和可用性请以模型页面为准。
TypeSafe 提供自己的接口和 API 密钥。官方快速入门使用 jev-latest,也演示了如何一次发送多个问题。
// Run on your server. Keep the API key out of browser code.
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) throw new Error("Set OPENROUTER_API_KEY");
const response = await fetch("https://openrouter.ai/api/alpha/decisions", {
method: "POST",
headers: {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "typesafe/jev-1.13",
state: {input: "A customer reports a duplicate charge."},
questions: {
team: {
type: "choice",
instructions: "Which team should handle this?",
criteria: {
billing: "Payments and refunds",
technical: "Bugs and integrations"
}
},
urgency: {
type: "score",
instructions: "How urgent is the issue?",
criteria: ["Can wait", "Needs attention today", "Immediate action"]
},
escalate: {
type: "noul",
instructions: "Should a human review this first?",
criteria: {false: "No review needed", true: "Review before acting"}
}
}
})
});
if (!response.ok) throw new Error("Decision request failed");
const {answers} = await response.json();
console.log(answers.team.choice, answers.urgency.score, answers.escalate.noul);模型选中的选项键,也是概率最高的选项。
根据各等级的概率加权得到的位置,可能落在两个等级之间。
是非问题的 0 到 1 数值;越接近 1 越倾向于“是”。
上线前请用有代表性的工单测试,记录模型版本,并把结果不确定或出错代价高的情况交给人工复核。示例中的 0.8 只是演示阈值。