Rerank API

接口

POST /v1/rerank
Authorization: Bearer tp_your_api_key
Content-Type: application/json

请求体

字段必填说明
modelGET /v1/models 返回且 capability 为 rerank 的模型 id
query查询文本
documents待排序文档数组,支持字符串或 JSON 对象
top_n返回前 N 条
return_documents是否返回文档内容
user终端用户标识,目标模型支持时透传

示例

curl -X POST "https://newapi.yxhhkj.com/v1/rerank" \
  -H "Authorization: Bearer tp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "rerank_model_from_models_api",
    "query": "model routing",
    "documents": [
      "TokenPostie routes model calls.",
      "Billing must stay deterministic."
    ],
    "top_n": 1,
    "return_documents": true
  }'

用量口径

Rerank 优先按输入 token 处理。如果上游只返回 search_units 等非 token 计量,TokenPostie 会把用量标记为需要复核,避免直接形成错误账单。