为开发者而生
一次接入 Decisions API,调用多种模型
沿用相同的 state 和 questions 结构,把 Decisions API Playground 中的请求迁移到后端。选择支持的模型、创建 API key,即可使用生成的 cURL、JavaScript 或 Python 示例。探索不同决策模型时,统一端点让接入方式保持熟悉。
从服务端使用 Bearer token 请求 Decisions API。成功响应包含结构化答案与用量信息。读取答案前检查响应状态,保留请求标识以便排查,并明确处理错误。至于是分配工单、请求审核还是触发下一步,由你的应用决定。
Decisions API 的 Playground、API 和评测共用一个余额,按相同的模型费率计费。每次调用前预留预算,成功后按实际输入用量结算,失败调用退还积分。接入前可先核对请求与模型费率。
POST /v1/systemone
typesafe/jev-1.13 · upstage/solar-decide · jaredpalmer/kev-4b · laya-english · laya-multilingual · laya-auto
// Server-side JavaScript (Node 20+ or Bun). Set JEV_API_KEY.
const response = await fetch("https://decisions-api.org/v1/systemone", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.JEV_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "typesafe/jev-1.13",
"state": "I was charged twice for order A-4471. Please refund the duplicate payment.",
"questions": {
"route": {
"type": "choice",
"instructions": "Which team should handle this ticket? Use other when no option fits.",
"criteria": {
"billing": "Payments, charges and refunds",
"technical": "Bugs and product errors",
"account": "Login and account access",
"other": "None of these teams"
}
}
}
}),
});
const body = await response.json();
if (!response.ok || body.code !== 0) throw new Error(body.message);
console.log(body.data.result.answers);
console.log(body.data.creditsUsed);