Skip to content

[Bug/错误]: 对齐阶梯计价的计算方式 #1582

@pandada8

Description

@pandada8

Pre-submission Checklist / 提交前检查

  • I have searched the existing issues and this bug has not been reported / 我已搜索现有 issues,此 Bug 尚未被报告
  • I have read the documentation / 我已阅读文档
  • I am using the latest version of AxonHub / 我正在使用 AxonHub 的最新版本

FAQ Check / FAQ 检查

  • I have checked the FAQ and this bug is not covered there / 我已查阅 FAQ,此 Bug 未被覆盖

Bug Description / Bug 描述

当前 axonhub 实现的阶梯计价为分段单独计价,然后求和。和大部分的厂商计费逻辑不一致。下面为使用阶梯计价的一些厂商

百炼

百炼部分模型实行阶梯计费。单价取决于单次请求的输入 Token 总量。该请求的所有 Token 均按对应阶梯的单价结算。
例如,某模型设有两档计费区间:0 < Token ≤ 32K 和 32K < Token ≤ 128K。若输入 100K Token,因数值落在第二区间(32K < 100K ≤ 128K),所有 Token 均按第二档单价结算。

https://help.aliyun.com/zh/model-studio/model-pricing

OpenAI & Anthropic

The part most coverage missed: it wasn't a marginal surcharge on overflow tokens. The premium applied to the entire request. Send 201K tokens and every single one - including the first 200K - billed at the inflated rate. A 700K-token legal document review on Sonnet 4.6 cost $4.20 in input alone, not the $2.10 you'd expect from the advertised $3/M rate.
https://tokencost.app/blog/anthropic-long-context-flat-pricing
当然 Anthropic 现在只有一个价格了

豆包

分段计费:部分模型适用,不同的输入长度(和输出长度),token单价不同:
举例:请求输入 200k tokens,输出 14k tokens,满足 输入长度 (128, 256] 条件,模型输入输出 token 按照:输入 2.4 元/百万 token,输出 24 元/百万 token 单价计费。
https://www.volcengine.com/docs/82379/1544106?lang=zh

OpenRouter

When using tiered pricing, the first tier (index 0) is the base pricing that applies when input tokens are below the min_context threshold. The second tier applies when input tokens meet or exceed the min_context value.
https://openrouter.ai/docs/guides/get-started/for-providers/

new-api

https://github.com/QuantumNous/new-api/blob/main/pkg/billingexpr/expr.md#expression-examples
从例子看也是直接使用最后一个阶梯的价格

实际上目前很难找出按照每段单格累加的厂商。

Steps to Reproduce / 复现步骤

N/A

Expected Behavior / 期望行为

使用输入长度匹配到的单价直接作为最终单价计算,或者新增一个新的阶梯计价模式

Error Message / 错误消息

Operating System / 操作系统

Linux (Ubuntu/Debian) / Linux(Ubuntu/Debian)

AxonHub Version / AxonHub 版本

v0.9.34

Usage Scenario / 使用场景

API

API Format / API 格式

N/A / 不适用

Channel Type / 渠道类型

N/A / 不适用

Logs / 日志

Additional Context / 其他补充信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions