narev-lookup-llm-pricing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Look up LLM pricing

查询LLM定价

This skill is the in-repo API reference for the Narev Cloud Pricing endpoints (same behavior as
/platform/api-reference/endpoint/pricing/...
, tightened for agents). Use it for contracts and workflows; for patterns that write the catalog into the repo, see
update-llm-pricing
.
Two endpoints, both under
https://www.narev.ai
.
EndpointMethodPurpose
/api/models/pricing
GET
List the catalog. Filter by
model_id
,
search
,
provider
,
subprovider
. Paginated.
/api/models/pricing/calculate
POST
Compute the USD cost of one call given
modelId
,
provider
, and a
usage
object.
Token rates are USD per token (not per 1K, not per 1M).
本技能是Narev云定价端点的仓库内API参考文档(与
/platform/api-reference/endpoint/pricing/...
的行为一致,专为Agent优化)。适用于合同与工作流场景;若需将定价目录写入仓库的模式,请查看
update-llm-pricing
两个端点均位于
https://www.narev.ai
域名下。
端点地址请求方法用途
/api/models/pricing
GET
列出定价目录。可通过
model_id
search
provider
subprovider
进行筛选,支持分页。
/api/models/pricing/calculate
POST
根据
modelId
provider
usage
对象计算单次调用的美元成本。
Token费率为每token对应的美元价格(非每千token或每百万token)。

When to use this skill

何时使用本技能

  • "What does
    gpt-4o
    cost on OpenAI right now?"
  • "Calculate how much this prompt cost me."
  • "How much do cached input tokens cost on Anthropic for
    claude-sonnet-4
    ?"
  • "List the providers that serve
    llama-3.1-70b
    and their rates."
  • Any flow that needs token-to-dollar conversion against a current catalog.
If the user wants to automate fetching the catalog and commit mapped prices (offline or deterministic billing), switch to
update-llm-pricing
— it builds on the
GET
behavior this page defines. If they want prices to resolve at runtime inside their app via the SDK, point them at
add-usage-based-billing
.
  • "当前OpenAI上的
    gpt-4o
    定价是多少?"
  • "计算这个提示词调用花费了多少钱。"
  • "Anthropic的
    claude-sonnet-4
    中缓存输入token的成本是多少?"
  • "列出提供
    llama-3.1-70b
    的服务商及其费率。"
  • 任何需要基于当前目录进行token转美元换算的流程。
如果用户想要自动化获取定价目录并提交映射后的价格(用于离线或确定性计费),请切换至
update-llm-pricing
——它基于本页定义的
GET
行为构建。如果用户希望在应用运行时通过SDK解析价格,请引导他们使用
add-usage-based-billing

Inputs you need

所需输入

The pricing endpoints are public. No API key, bearer token, or authentication header is required — call them directly.
  • For listing: optional
    model_id
    ,
    search
    ,
    provider
    ,
    subprovider
    ,
    sort_by
    (
    model_id
    |
    provider
    |
    subprovider
    ),
    order
    (
    asc
    |
    desc
    ),
    page
    ,
    limit
    (max
    1000
    , default
    100
    ).
  • For calculation:
    modelId
    ,
    provider
    , and
    usage
    with
    promptTokens
    ,
    completionTokens
    ,
    cacheReadTokens
    ,
    cacheWriteTokens
    ,
    reasoningTokens
    (all required integers — pass
    0
    if unused).
    subprovider
    is required when one model is served by multiple providers (
    bedrock
    ,
    openrouter
    ,
    together
    , etc.).
    webSearchCount
    and
    isByok
    are optional.
定价端点为公开接口,无需API密钥、Bearer令牌或认证头——可直接调用。
  • 列表查询:可选参数包括
    model_id
    search
    provider
    subprovider
    sort_by
    (可选值:
    model_id
    |
    provider
    |
    subprovider
    )、
    order
    (可选值:
    asc
    |
    desc
    )、
    page
    limit
    (最大值
    1000
    ,默认值
    100
    )。
  • 成本计算:必填参数为
    modelId
    provider
    ,以及包含
    promptTokens
    completionTokens
    cacheReadTokens
    cacheWriteTokens
    reasoningTokens
    usage
    对象(所有参数均为必填整数——若未使用则传入
    0
    )。当同一模型由多个服务商(如
    bedrock
    openrouter
    together
    等)提供时,
    subprovider
    为必填参数。
    webSearchCount
    isByok
    为可选参数。

Workflow: list pricing

工作流:查询定价列表

  1. Confirm the model and (if needed) the provider. For "OpenAI's GPT-4o", filter by
    model_id=gpt-4o
    and
    provider=openai
    .
  2. Call the listing endpoint:
    bash
    curl -G 'https://www.narev.ai/api/models/pricing' \
      --data-urlencode 'model_id=gpt-4o' \
      --data-urlencode 'provider=openai'
  3. The response is
    { data: ModelPricingEntry[], meta: { page, limit, total, total_pages } }
    . Each entry has
    model_id
    ,
    provider
    ,
    subprovider
    , and a
    pricing
    object. The fields you most likely care about:
    • price_prompt
      — USD per input token.
    • price_completion
      — USD per output token.
    • price_input_cache_read
      ,
      price_input_cache_write
      — USD per cached input token.
    • price_internal_reasoning
      — USD per reasoning output token.
    • pricing_request
      — flat USD per request.
    • price_web_search
      — USD per web-search invocation.
    • pricing_discount
      — fractional discount (
      0
      1
      ) applied across all rates.
    • price_image
      ,
      price_image_output
      ,
      price_audio
      ,
      price_audio_output
      ,
      price_input_audio_cache
      — USD per unit, when applicable.
  4. Surface the requested fields. Multiply by
    1_000_000
    if the user expects "USD per million tokens".
  5. If
    meta.total_pages > 1
    , page through with
    page=2
    ,
    page=3
    , …. Filter rather than paginating the whole catalog whenever possible.
  1. 确认模型及(如需)服务商。例如查询“OpenAI的GPT-4o”,需通过
    model_id=gpt-4o
    provider=openai
    进行筛选。
  2. 调用列表查询端点:
    bash
    curl -G 'https://www.narev.ai/api/models/pricing' \
      --data-urlencode 'model_id=gpt-4o' \
      --data-urlencode 'provider=openai'
  3. 响应格式为
    { data: ModelPricingEntry[], meta: { page, limit, total, total_pages } }
    。每个条目包含
    model_id
    provider
    subprovider
    pricing
    对象。最常用的字段包括:
    • price_prompt
      —— 输入token对应的美元价格。
    • price_completion
      —— 输出token对应的美元价格。
    • price_input_cache_read
      price_input_cache_write
      —— 缓存输入token对应的美元价格。
    • price_internal_reasoning
      —— 推理输出token对应的美元价格。
    • pricing_request
      —— 每次请求的固定美元费用。
    • price_web_search
      —— 每次网页搜索调用的美元费用。
    • pricing_discount
      —— 适用于所有费率的折扣比例(取值范围
      0
      1
      )。
    • price_image
      price_image_output
      price_audio
      price_audio_output
      price_input_audio_cache
      —— 对应单位的美元价格(适用时显示)。
  4. 展示用户所需的字段。如果用户期望“每百万token的美元价格”,需将数值乘以
    1_000_000
  5. meta.total_pages > 1
    ,需通过
    page=2
    page=3
    ……进行分页查询。尽可能优先筛选而非遍历整个目录。

Workflow: calculate the cost of a call

工作流:计算单次调用成本

  1. Collect token usage. Required integers:
    promptTokens
    ,
    completionTokens
    ,
    cacheReadTokens
    ,
    cacheWriteTokens
    ,
    reasoningTokens
    . If a category does not apply, pass
    0
    .
  2. POST the request:
    bash
    curl -X POST 'https://www.narev.ai/api/models/pricing/calculate' \
      -H 'Content-Type: application/json' \
      -d '{
        "modelId": "gpt-4o",
        "provider": "openai",
        "subprovider": "OpenAI",
        "usage": {
          "promptTokens": 1000,
          "completionTokens": 500,
          "cacheReadTokens": 0,
          "cacheWriteTokens": 0,
          "reasoningTokens": 0
        }
      }'
  3. The 200 response contains:
    • pricing
      — the rates Narev applied (
      input
      ,
      output
      ,
      request
      ,
      inputCacheRead
      ,
      inputCacheWrite
      ,
      internalReasoning
      ,
      webSearch
      ).
    • costBreakdown.total
      — the final USD total.
    • usage
      — echoed back so the caller can verify what was billed.
  4. Report
    costBreakdown.total
    to the user. If they ask "where does that number come from?", show
    pricing
    and explain that each token category was multiplied by its rate and summed.
  1. 收集token使用数据。必填整数参数:
    promptTokens
    completionTokens
    cacheReadTokens
    cacheWriteTokens
    reasoningTokens
    。若某类别不适用,传入
    0
  2. 发送POST请求:
    bash
    curl -X POST 'https://www.narev.ai/api/models/pricing/calculate' \
      -H 'Content-Type: application/json' \
      -d '{
        "modelId": "gpt-4o",
        "provider": "openai",
        "subprovider": "OpenAI",
        "usage": {
          "promptTokens": 1000,
          "completionTokens": 500,
          "cacheReadTokens": 0,
          "cacheWriteTokens": 0,
          "reasoningTokens": 0
        }
      }'
  3. 200响应包含以下内容:
    • pricing
      —— Narev应用的费率(包括
      input
      output
      request
      inputCacheRead
      inputCacheWrite
      internalReasoning
      webSearch
      )。
    • costBreakdown.total
      —— 最终的美元总成本。
    • usage
      —— 回传的使用数据,便于调用方验证计费依据。
  4. 向用户展示
    costBreakdown.total
    。如果用户询问“这个数值是如何计算的?”,请展示
    pricing
    并说明每个token类别均乘以对应费率后求和。

Constraints and edge cases

约束条件与边缘情况

  • 402 Payment Required — model is enterprise-only. The error response has
    error
    set and
    pricing: null
    . Tell the user the model is not in the public catalog and point them at Narev for enterprise access.
  • 404 Not Found — no public pricing for that
    modelId
    +
    provider
    (+
    subprovider
    ). Re-check IDs against the listing endpoint or drop
    subprovider
    .
  • 400 Bad Request
    usage
    failed validation. Most common cause: a missing required integer field. Pass
    0
    , not
    null
    or absent.
  • Rates are USD per token. Do not divide or multiply on the way in. Convert only when displaying.
  • subprovider
    matters.
    Models like
    llama-3.1-70b
    are hosted by Bedrock, OpenRouter, Together, etc. at different prices. If the user does not know the subprovider, list first to see options, then calculate.
  • Do not hardcode rates. Prices change. If the user wants stable values they can commit and review, switch to
    update-llm-pricing
    .
  • 402 Payment Required —— 模型为企业专属。错误响应中
    error
    字段会被设置,
    pricing
    null
    。告知用户该模型不在公开目录中,并引导他们联系Narev获取企业权限。
  • 404 Not Found —— 该
    modelId
    +
    provider
    (+
    subprovider
    )组合无公开定价。请通过列表查询端点重新核对ID,或移除
    subprovider
    参数重试。
  • 400 Bad Request ——
    usage
    参数验证失败。最常见原因是缺少必填整数字段。请传入
    0
    ,而非
    null
    或留空。
  • 费率为每token美元价格。调用时请勿进行除法或乘法运算,仅在展示时进行转换。
  • subprovider
    至关重要
    。像
    llama-3.1-70b
    这样的模型由Bedrock、OpenRouter、Together等不同服务商托管,定价各不相同。如果用户不知道subprovider,先查询列表查看可选选项,再进行成本计算。
  • 请勿硬编码费率。价格会发生变动。如果用户需要可提交并审核的稳定数值,请切换至
    update-llm-pricing

Reference

参考链接

  • API overview:
    /platform/api-reference/introduction
  • List endpoint:
    /platform/api-reference/endpoint/pricing/list-model-pricing
  • Calculate endpoint:
    /platform/api-reference/endpoint/pricing/calculate-cost-for-a-model-call
  • API概览:
    /platform/api-reference/introduction
  • 列表查询端点:
    /platform/api-reference/endpoint/pricing/list-model-pricing
  • 成本计算端点:
    /platform/api-reference/endpoint/pricing/calculate-cost-for-a-model-call