快速上手

Jev API 快速上手 — 三步完成第一次调用

五分钟拿到类型化 Jev 响应。无需 TypeSafe 账号——经 OpenRouter 调用 typesafe/jev-1.13,返回可直接分支的概率结果。

1

获取 OpenRouter API Key

在 OpenRouter 注册账号并生成密钥。Jev 的模型 ID 是 typesafe/jev-1.13,无需再单独注册 TypeSafe。

export OPENROUTER_API_KEY="sk-or-..."
提示: 密钥请放在环境变量里,不要写进源码。
2

发出第一个请求

请求体里带上状态文本,以及一个或多个问题。下面是一个最小 curl 示例:

# Ask Jev to route a support ticket
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "typesafe/jev-1.13",
    "messages": [{
      "role": "user",
      "content": {
        "state": "I was charged twice for the same order #4821. Please fix this.",
        "questions": [{
          "type": "choice",
          "text": "Which team should handle this?",
          "options": ["billing", "tech_support", "sales"]
        }]
      }
    }]
  }'
3

读取类型化结果

Jev 返回的是概率,不是一段散文。代码可以直接分支判断:

{
  "answers": [{
    "type": "choice",
    "text": "Which team should handle this?",
    "selected": "billing",
    "confidence": 0.94,
    "distribution": {
      "billing": 0.94,
      "tech_support": 0.04,
      "sales": 0.02
    }
  }]
}
注意: confidence 是最高选项的概率。建议设置阈值(例如低于 0.7),把低置信度样本转人工,而不是硬猜。

接下来看什么

去场景库找即取即用的问题配置,或到 OpenRouter 模型页查看完整参数说明。

相关阅读