获取模型价格

GET/v1/models/{model_id}/pricing

返回你的账户现在使用这个模型要付的价格。

model_id 用 GET /v1/models 返回的 data[].id。大小写都可以。响应里的 model 是之后请求应使用的 id。

身份验证

Authorization Bearer

必填。发送 API Key(sk-...)。没有 Key 时返回 401。

价格属于这把 Key 的账户。企业 Key 返回该企业的价格;已经谈好专属价时,返回专属价。个人 Key 不会拿到其他企业的专属价。

Path Parameters

model_idstringrequired

模型 ID,取自 GET /v1/models 的 data[].id。

怎么算应付价

  1. 在 plan.rules 里选一条规则。规则已经按尝试顺序排好。用第一条 when_expr 匹配的规则。{ "all": [] } 匹配任何请求,所以带这个条件的规则是前面规则都没匹配上时的价格。
  2. 读这条规则每个组件的 rate。token 的 unit 为 1M 时,表示每一百万 token 的美元价格。顶层 unit 的 per_1m_tokens 是同一个意思。
  3. 再看账户系数:
    • price_factor 是数字:应付价 = rate × price_factor
    • price_factor 是 null:应付价 = rate

discount_percent_off 只是把系数写成百分比。0.80 和 20.00 是同一个折扣。乘完系数之后,不要再减一次这个百分比。

offer 表示什么

LIST这个模型的目录价。rate
MODEL_FACTOR这个企业对这个模型有一个系数。rate 是乘系数之前的目录价。rate × price_factor
PLATFORM_FACTOR个人账户有一个系数。算法和 MODEL_FACTOR 相同。rate × price_factor
TENANT_PLAN这个企业谈好的专属价。rate 已经是专属价。rate

plan.source 说明 rate 从哪来。TENANT_PLAN 是专属价。PLATFORM_DEFAULT 是平台目录价;price_factor 有值时仍要相乘。

一条规则什么时候生效

when_expr.all 里的条件要同时成立。常见是这两个字段:

utc_weekdayUTC 星期。1 是周一,7 是周日。op 为 in 表示星期在列出的数字里。
utc_minute_of_dayUTC 当天第几分钟,0 是 00:00,1439 是 23:59。op 为 between、值为 [60, 239] 时,表示第 60 分钟到第 239 分钟,也就是 UTC 01:00 到 04:00 之前。
JSON
1{
2  "all": [
3    { "op": "between", "field": "utc_minute_of_day", "value": [60, 239] },
4    { "op": "in", "field": "utc_weekday", "value": [1, 2, 3, 4, 5] }
5  ]
6}

这条规则是周一到周五的 UTC 01:00–03:59。{ "all": [] } 没有条件,表示其余时间的价格。

每个组件在计什么

uncached_input_tokens没有从缓存读取的输入 token。
input_tokens、prompt_tokens输入 token。
cache_read_tokens从缓存读取的输入 token。
cache_creation_tokens写入缓存的 token。
output_tokens、completion_tokens生成的输出 token。
thinking_tokens、reasoning_tokens思考 token。模型把思考单独计价时才会出现。

type 为 linear 表示费用随用量按比例增加。rate 是该 meter 每一个 unit 的价格。

有些组件还会带这些字段:

  • included_units:先免费这么多个单位,超出部分才按 rate 计。
  • subtract:这些用量已经在别的组件里计过,这里要减掉,避免同一段用量计两次。
  • dimension_per_unit:多少个原始单位算 1 个计费单位。没有这个字段时,1 个用量就是 1 个计费单位。

name 是方案名称。description 是规则名称。price_type 是内部标记。这三个都不参与算钱。

as_of 是这次响应的 UTC 时间。返回的是现在的价格,不包含以前的折扣。

Response

objectstring

固定为 model.pricing。

modelstring

之后请求应使用的模型 ID。

currencystring

rate 的货币,例如 USD。

unitstring

per_1m_tokens。token 价格按每一百万 token 计,和组件里的 1M 是同一口径。

offerstring

LIST:付 rate。MODEL_FACTOR 或 PLATFORM_FACTOR:付 rate × price_factor。TENANT_PLAN:专属价,付 rate。

price_factornumber|null

账户系数。0.80 表示付 rate 的 80%。null 表示 rate 已经是应付价。不要再减一次 discount_percent_off。

discount_percent_offnumber|null

同一个系数写成折扣百分比。0.80 就是 20.00。系数不小于 1 时为 null。

planobject

这个模型的价格规则,以及单价从哪来。

plan.sourcestring

PLATFORM_DEFAULT:目录价,price_factor 有值时再相乘。TENANT_PLAN:专属价,直接付 rate。

plan.rulesobject[]

按顺序尝试。用第一条 when_expr 匹配的规则。

as_ofstring

这次响应的 UTC 时间。

Errors

401authentication_error—没有 API Key。
404not_found_errormodel_not_found模型不存在,或这个账户不能使用它。

请求

Shell
1curl https://api.token360.ai/v1/models/example-model/pricing \
2  -H "Authorization: Bearer sk-your-api-key"

响应

下面的数字只作说明。线上价格以接口返回为准。

JSON
1{
2  "object": "model.pricing",
3  "model": "example-model",
4  "currency": "USD",
5  "unit": "per_1m_tokens",
6  "offer": "MODEL_FACTOR",
7  "price_factor": 0.80,
8  "discount_percent_off": 20.00,
9  "plan": {
10    "source": "PLATFORM_DEFAULT",
11    "rules": [
12      {
13        "name": "Example model",
14        "price_type": "PRICING_PLAN_V2",
15        "description": "weekday-morning",
16        "when_expr": {
17          "all": [
18            { "op": "between", "field": "utc_minute_of_day", "value": [60, 239] },
19            { "op": "in", "field": "utc_weekday", "value": [1, 2, 3, 4, 5] }
20          ]
21        },
22        "components": [
23          { "type": "linear", "meter": "uncached_input_tokens", "unit": "1M", "rate": 1.00 },
24          { "type": "linear", "meter": "output_tokens", "unit": "1M", "rate": 2.00 }
25        ]
26      },
27      {
28        "name": "Example model",
29        "price_type": "PRICING_PLAN_V2",
30        "description": "other-times",
31        "when_expr": { "all": [] },
32        "components": [
33          { "type": "linear", "meter": "uncached_input_tokens", "unit": "1M", "rate": 0.50 },
34          { "type": "linear", "meter": "output_tokens", "unit": "1M", "rate": 1.00 }
35        ]
36      }
37    ]
38  },
39  "as_of": "2026-10-18T15:00:00Z"
40}

周一 UTC 02:00 命中第一条。输入是 1.00 × 0.80 = 0.80 美元 / 一百万 token,输出是 2.00 × 0.80 = 1.60。

其余时间命中第二条。输入是 0.50 × 0.80 = 0.40 美元 / 一百万 token,输出是 0.80。

此页面对您有帮助吗?