判定 API

用同一把 Tokener.ai API 密钥和同一份额度调用 TypeSafe System One 判定模型。

更新于 2026-09-21
在 GitHub 编辑

判定模型不生成自由文本,而是针对一段状态回答结构化问题。它不兼容 OpenAI 与 Anthropic:不在 /v1 base URL 下,也无法通过 OpenAI 或 Anthropic SDK 调用。

状态方法路径用途
支持POST/typesafe/v1/systemoneTypeSafe System One 判定模型

鉴权、额度扣费、错误格式以及 x-request-id / request-id 响应头,与模型 API 其余路径完全一致。Tokener.ai API 密钥使用 Bearer token。响应为单个 JSON 对象。

请求

Shell
curl https://api.tokener.dev/typesafe/v1/systemone \
  -H "Authorization: Bearer $TOKENER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev-latest",
    "state": "The customer cannot sign in.",
    "questions": {
      "department": {
        "type": "choice",
        "instructions": "Route this request.",
        "criteria": {
          "technical": "Technical support",
          "billing": "Billing"
        }
      }
    }
  }'

state 是待判定的文本。questions 下的每一项是针对该状态的一个问题,criteria 列出它允许的答案。增加条目即可在一次请求里问多个问题。

响应

JSON
{
  "answers": {
    "department": {
      "type": "choice",
      "choice": "technical",
      "confidence": 1.0,
      "probabilities": { "technical": 1.0, "billing": 0.0 }
    }
  },
  "usage": { "input_tokens": 310, "output_tokens": 31 }
}

每个答案沿用你给该问题的 key,因此结果可按名字对回去。confidence 与 probabilities 可用于把不确定的情况转交人工,而不是直接采用 choice。

模型与价格

判定模型在 模型 目录的 判定 分类下列出,并给出每百万 token 的 公开价格。在 model 字段传入目录里的模型 id,例如 jev-latest。

调用前请先在 API 密钥 中创建密钥。错误响应格式与完整 错误码表见 错误。