docai.cc

Provider Pricing API

协议OpenAPI 3.1
路径GET /api/provider/pricing
Schema Version1.1

OpenAPI 参考

给中转站实现 hvoyai.com 价格接口使用的轻量 OpenAPI 3.1 参考。

方法
GET
接口
/api/provider/pricing
响应类型
application/json; charset=utf-8

可选签名请求头

如果站点启用签名校验,请计算 hex(HMAC-SHA256(auth_secret, X-Hvoy-Ts))。时间戳与当前时间差不得超过 60 秒。

X-Hvoy-Ts可选

可选。hvoy 抓取时间戳(Unix 秒)。如果站点启用了签名校验,则必需,且与当前时间差不得超过 60 秒。

1747886400
X-Hvoy-Sign可选

可选。`hex(HMAC-SHA256(auth_secret, X-Hvoy-Ts))`。如果站点启用了签名校验,则必需。

9f0f4d7f6a5a648242cc0d2e4c2cfc0d4d79cf50615a5c1304f8cbea57c478c4

响应结构

data

字段类型规则示例说明
currencystring必需"CNY"币种。当前协议固定为 `CNY`。
price_unitstring必需"per_1m_tokens"默认价格单位。支持 `per_1m_tokens`、`per_call` 和 `per_second`(`per_call` / `per_second` 需要 `schema_version` 为 `1.1`);单条模型可用 `models[].price_unit` 覆盖。
site_namestring可选"hvoy"站点名称,用于后台排查和展示。
site_domainstring可选"hvoyai.com"站点域名,用于来源追踪。
updated_atstring必需"2026-04-22T12:00:00Z"本批价格数据的生成时间或最后更新时间。必须带时区信息,推荐使用 UTC 的 ISO 8601,例如 `2026-04-22T12:00:00Z`。
modelsarray必需价格列表。每一项代表一个 `model + group` 组合。

data.models[]

字段类型规则示例说明
model_namestring必需"claude-sonnet-4-6"模型稳定标识。机器匹配用 ID,不是展示名。
group_namestring必需"cc"分组稳定标识。机器匹配用 ID,不是展示名。对外发布后不应频繁改名;改名会导致原 group 下线,并需要重新抓取,预计约 6 小时后重新进入排行榜。
price_unitstring可选"per_call"当前模型/分组的价格单位。不传时继承 `data.price_unit`。
input_pricenumber可选7.5输入价格,单位为 `CNY / 1M tokens`。最终 price_unit 为 `per_1m_tokens` 时必需。
output_pricenumber | null可选37.5输出价格,单位为 `CNY / 1M tokens`。如果不提供,可传 `null`。
cache_input_pricenumber | null可选0.75缓存读价格,单位为 `CNY / 1M tokens`。Claude 场景下应填 cache hits and refreshes,GPT 场景下通常对应 cached input。
cache_create_pricenumber | null可选9.375缓存写入价格,单位为 `CNY / 1M tokens`。如果只有单档写价填这里;Claude 场景下应填 5-minute cache writes。
cache_create_price_1hnumber | null可选151 小时缓存写入价格,单位为 `CNY / 1M tokens`。Claude 场景下应填 1-hour cache writes;其他服务商通常可传 `null`。
unit_pricenumber可选0.2按次或按秒价格,必须大于 0。最终 price_unit 为 `per_call` 时单位为 `CNY / 次`;为 `per_second` 时是 `billing_basis.resolution` 那一档的最终秒价,单位为 `CNY / 秒`,不含参考视频加价。最终 price_unit 为 `per_call` 或 `per_second` 时必需。
billing_basisobject可选{"resolution":"480p"}最终 price_unit 为 `per_second` 时必填。`resolution` 为该秒价对应的分辨率,请写成 `480p`、`720p`、`1080p` 这种形式;只能用字母、数字、`.`、`_`、`-`,最长 40 个字符,不区分大小写。参考档为 480p:提供 480p 时必须用 480p 报价,否则模型被忽略;没有 480p 时用最便宜的一档,传了 `variants` 时 `unit_price` 必须等于其中最低的秒价,否则模型被忽略。按秒计费只用于视频生成模型,非视频模型请不要使用 `per_second`,不要为了通过校验填写分辨率。
variantsarray可选[{"resolution":"480p","unit_price":0.55,"ref_video_price":8.25},{"resolution":"720p","unit_price":1.15,"ref_video_price":17.25}]可选,仅 `per_second` 使用,最多 8 档,分辨率不能重复(不区分大小写)。每档包含 `resolution`、`unit_price`(CNY / 秒,>0)、`ref_video_price`(每条参考视频加价 CNY,可省略)。必须有一档与 `billing_basis.resolution` 相同且价格等于模型 `unit_price`,否则模型被忽略;`variants` 本身格式错误时只忽略 `variants`,模型价格保留。只有一档但有参考视频加价时,传一项 `variants`。其它清晰度会显示在首页和榜单价格旁的浮层里。
enabledboolean可选true该 `model + group` 当前是否可售。缺失时抓取方默认按 `true` 处理。若某个组合未出现在返回列表中,抓取方应视为未匹配,不应自动推断为下线。
notestring可选"活动价"附加说明,不参与价格计算。

按秒计费

协议 1.1 支持按秒计费,只用于视频生成模型。非视频模型请不要使用 per_second,也不要为了通过校验填写分辨率。data.price_unit 是默认单位,可以是 per_1m_tokens、per_call 或 per_second;某一条模型需要另一种计法时,写这条自己的 price_unit。三种单位可以出现在同一份价格里。per_call 的 unit_price 是元/次,per_second 的 unit_price 是元/秒。"1.0" 不能使用按次或按秒。

按秒计费时 billing_basis 必填。billing_basis.resolution 写这个秒价对应的分辨率,例如 480p,榜单和模型价格页会把它显示在价格旁边。unit_price 是这一档的最终秒价,不含参考视频加价。不要把秒价放进 per_call,也不要靠 note 说明单位,note 不参与价格计算。

参考档是 480p。你提供 480p 时,必须用 480p 报 unit_price,并把 billing_basis.resolution 设为 480p;用其它档报价的模型会被忽略。没有 480p 时,用你最便宜的一档报价;传了 variants 时,unit_price 必须等于其中最低的秒价,否则该模型被忽略。

其它清晰度放在 variants,最多 8 档,分辨率不能重复。每一档的 unit_price 是元/秒;ref_video_price 是每条参考视频的加价(元/条),没有就省略。variants 里必须有一档与 billing_basis.resolution 相同,且价格等于模型上的 unit_price,否则该模型被忽略。variants 本身格式有误时只忽略 variants,模型价格保留。只有一档但有参考视频加价时,传一项 variants。其它清晰度会显示在首页和榜单价格旁的浮层里。

分辨率请写成 480p、720p、1080p 这种形式;只能使用字母、数字、.、_、-,最长 40 个字符,不区分大小写。模型名保持稳定 ID,例如 doubao-seedance-2.5,分辨率不要写进 model_name。

一条记录只有一种主单位。同一模型既有按次价又有按秒价时,提交按秒的那一条。按 token 计费的视频模型继续使用 per_1m_tokens。

默认单位建议保持 per_1m_tokens,只在按秒的模型上覆盖 price_unit;整站都是按秒时,可以把 data.price_unit 设为 per_second。

抓取 warning 原因码

抓取你的价格接口时,被跳过或被部分忽略的模型会产生一条 warning,格式为 models[<i>] <原因码>:<模型>/<分组>;variants_dropped 末尾多一段原因。

原因码说明
invalid_object这一项不是对象,已忽略。
missing_model_or_group缺少 model_name 或 group_name,已忽略。
model_price_unit_requires_1.1schema_version 为 "1.0" 时不能写模型级 price_unit,这条已忽略;需要按次或按秒请改用 "1.1"。
unsupported_price_unit不支持的 price_unit,这条已忽略。支持 per_1m_tokens、per_call、per_second。
duplicate_model_group同一 model_name + group_name 出现多次,只会使用其中一条,请去掉重复项。
invalid_input_priceinput_price 缺失、不是数字或小于 0,这条已忽略。
zero_input_price_skippedinput_price 为 0,这条已忽略。
invalid_unit_priceunit_price 缺失、不是数字或小于 0,这条已忽略。
zero_unit_price_skippedunit_price 为 0,这条已忽略。
invalid_billing_basis按秒计费必须提供 billing_basis.resolution,只能用字母、数字、.、_、-,最长 40 个字符;这条已忽略。按秒计费只用于视频生成模型,非视频模型请不要使用 per_second。
billing_basis_mismatchvariants 里找不到 billing_basis.resolution 这一档,或这一档的价格与 unit_price 不同;这条已忽略。
billing_basis_not_referencevariants 里有 480p,但没有用 480p 报价。请把 unit_price 改成 480p 的秒价,billing_basis.resolution 设为 480p;这条已忽略。
billing_basis_not_lowest没有 480p 时必须用最便宜的一档报价,unit_price 不是 variants 里最低的秒价;这条已忽略。
variants_droppedvariants 格式有误,只忽略了 variants,模型价格保留。

variants_dropped 的原因

原因说明
not_array不是数组
empty是空数组
too_many超过 8 档
invalid_item某一档不是对象
invalid_resolution某一档的 resolution 不合规
invalid_unit_price某一档的 unit_price 无效或不大于 0
invalid_ref_video_price某一档的 ref_video_price 无效或小于 0
duplicate_resolution分辨率重复(不区分大小写)

可以用抓取测试页自查接口,结果里会显示这些 warning 和说明。

成功示例

{
  "schema_version": "1.1",
  "success": true,
  "message": "",
  "data": {
    "currency": "CNY",
    "price_unit": "per_1m_tokens",
    "site_name": "hvoy",
    "site_domain": "hvoyai.com",
    "updated_at": "2026-04-22T12:00:00Z",
    "models": [
      {
        "model_name": "claude-sonnet-4-6",
        "group_name": "cc",
        "input_price": 7.5,
        "output_price": 37.5,
        "cache_input_price": 0.75,
        "cache_create_price": 9.375,
        "cache_create_price_1h": 15,
        "enabled": true,
        "note": ""
      },
      {
        "model_name": "gpt-5.4",
        "group_name": "codex",
        "input_price": 1.25,
        "output_price": 7.5,
        "cache_input_price": 0.125,
        "cache_create_price": 0.5,
        "cache_create_price_1h": null,
        "enabled": true,
        "note": ""
      },
      {
        "model_name": "gpt-image-2",
        "group_name": "sora",
        "price_unit": "per_call",
        "unit_price": 0.2,
        "enabled": true,
        "note": ""
      },
      {
        "model_name": "doubao-seedance-2.5",
        "group_name": "video",
        "price_unit": "per_second",
        "unit_price": 0.55,
        "billing_basis": {
          "resolution": "480p"
        },
        "variants": [
          {
            "resolution": "480p",
            "unit_price": 0.55,
            "ref_video_price": 8.25
          },
          {
            "resolution": "720p",
            "unit_price": 1.15,
            "ref_video_price": 17.25
          }
        ],
        "enabled": true,
        "note": ""
      }
    ]
  }
}

旧站文档归档;API 规范可能已更新。