# Jev Evaluate

使用 Jev System One 的结构化决策接口。

Jev 不是聊天模型，不支持把请求发送到 `/v1/chat/completions` 或 `/v1/messages`。使用 Jev 时调用独立的 `POST /v1/evaluate` 接口，让服务端根据 `state` 和 `questions` 返回结构化、可直接分支处理的答案。

## 基础调用

```bash
curl https://kaienapi.com/v1/evaluate \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev",
    "state": {
      "customer_message": "I was charged twice for order ord_7429.",
      "duplicate_charge_usd": 680,
      "customer_identity_verified": true,
      "policy": "Refunds above USD 500 require human approval."
    },
    "questions": {
      "action": {
        "type": "choice",
        "instructions": "Choose the safest next action.",
        "criteria": {
          "allow": "Issue the refund immediately.",
          "review": "Require human approval before issuing the refund.",
          "deny": "Reject the refund request."
        }
      }
    }
  }'
```

## 请求字段

- `model`：填写 `jev`。
- `state`：业务上下文，可以是对象、数组或文本。网关不会替你解释业务字段，合理性校验由 Jev 服务完成。
- `questions`：问题映射。每个键对应一个需要在业务代码中使用的答案。
- `questions.<name>.type`：问题类型，可用 `choice`、`score` 或 `noul`。
- `questions.<name>.instructions`：告诉 Jev 要判断什么。
- `choice` 使用 `criteria` 对象列出选项及其含义。
- `score` 使用有序的 `criteria` 数组表示评分档位。
- `noul` 返回某个判断为真的概率；部分兼容服务也将它称为 `boolean`。

## 返回示例

```json
{
  "answers": {
    "action": {
      "type": "choice",
      "choice": "review",
      "confidence": 1,
      "probabilities": {
        "allow": 0,
        "confirm": 0,
        "deny": 0,
        "review": 1
      }
    }
  },
  "model": "jev",
  "usage": {
    "inputTokens": 382,
    "outputTokens": 45
  }
}
```

`answers` 的键与请求中的问题键一致。`choice` 返回选中的选项、置信度和各选项概率；`score` 返回分数及概率；`noul` 返回真假概率。`usage` 是服务端返回的 token 用量，便于记录调用情况。

## 调用和计费注意事项

- Jev 请求按次计费，不按 Chat Completions 的输入输出 token 价格计算。
- 业务代码应把概率和置信度当作决策信号，并自行设置人工确认、审批或其他安全边界。
- 不要把密码、API Key 或无关的私人数据放进 `state`。
- Jev 业务错误会以网关错误响应返回；失败请求不会保留成功调用的消费记录。
