Provider Pricing API Markdown

中转站价格数据源的完整字段与校验规范。

XTokenChecker / Hvoy 兼容价格接口规范

协议

  • 推荐路径:GET /api/provider/pricing
  • 支持 Schema:1.0、1.1
  • 币种:CNY
  • 默认单位:per_1m_tokens 或 per_call
  • 匹配键:model_name + group_name
  • 价格必须是 JSON number,不能传字符串数字
  • 未知价格传 null,不能传空字符串
  • 列表中缺少渠道表示“未匹配”,不代表明确下线
  • 已知渠道临时下线应返回 enabled: false

字段

字段必需含义
schema_version是1.0 或 1.1
success是请求结果
message否错误或诊断信息
data.currency是固定为 CNY
data.price_unit是默认计费单位
data.updated_at是带时区的 ISO 8601 时间
data.models是模型/渠道价格数组
model_name是稳定模型 ID
group_name是稳定渠道/分组 ID
price_unit否覆盖全局默认单位
input_priceToken 计费必需每 100 万输入 Token 人民币价格
output_price否每 100 万输出 Token 人民币价格
cache_input_price否缓存读取/命中价格
cache_create_price否缓存写入价;Claude 对应 5 分钟写缓存
cache_create_price_1h否Claude 1 小时写缓存价格
unit_price按次计费必需每次调用人民币价格
enabled否默认 true
note否仅展示的备注

混合计费示例

{
  "schema_version": "1.1",
  "success": true,
  "message": "",
  "data": {
    "currency": "CNY",
    "price_unit": "per_1m_tokens",
    "site_name": "example",
    "site_domain": "example.com",
    "updated_at": "2026-07-15T00:00:00Z",
    "models": [
      {
        "model_name": "claude-opus-4-8",
        "group_name": "official",
        "input_price": 10,
        "output_price": 50,
        "cache_input_price": 1,
        "cache_create_price": 12.5,
        "cache_create_price_1h": 20,
        "enabled": true
      },
      {
        "model_name": "gpt-image-2",
        "group_name": "image",
        "price_unit": "per_call",
        "unit_price": 0.2,
        "enabled": true
      }
    ]
  }
}

签名

可选请求头:

X-Hvoy-Ts: 1784073600
X-Hvoy-Sign: lowercase_hex_hmac_sha256
sign = hex(HMAC-SHA256(auth_secret, ts))

建议拒绝超出 60 秒窗口的时间戳。公开测试器固定使用 hvoy_provider_pricing_test_secret_v1_20260522。

校验规则

  • model_name + group_name 不允许重复。
  • Token 计费必须提供 input_price。
  • 按次计费必须满足 unit_price > 0。
  • 所有价格不得为负数。
  • 模型和渠道 ID 发布后应保持稳定;修改 group_name 会被视为新渠道。