generated from songquanpeng/gin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
额度计算过程中存在一些取整操作导致计算结果偏小 #599
Labels
bug
Something isn't working
Comments
你好具体在那个文件内呢?我想去做一下修改 |
wzxjohn
added a commit
to wzxjohn/one-api
that referenced
this issue
Oct 24, 2023
Use float64 during calc and do math.Ceil after calc. This will result in the quota being used slightly more than the official standard, but it will be guaranteed that it will not be less.
songquanpeng
added a commit
that referenced
this issue
Nov 5, 2023
* fix: change quota calc code (close #599) Use float64 during calc and do math.Ceil after calc. This will result in the quota being used slightly more than the official standard, but it will be guaranteed that it will not be less. * chore: remove blank line --------- Co-authored-by: JustSong <songquanpeng@foxmail.com>
humphery755
added a commit
to humphery755/one-api
that referenced
this issue
Nov 19, 2023
…ync-one-api * 'main' of https://github.com/songquanpeng/one-api: fix: cloudflare test & expose detailed info about test failures (songquanpeng#715) feat: support tts model (songquanpeng#713) feat: keep sync with dall-e updates (songquanpeng#679) fix: fix PaLM not working issue (songquanpeng#667) fix: fix channel_id column name (songquanpeng#681, close songquanpeng#688) feat: add improve docker-compose.yml and support fast startup (songquanpeng#685) docs: add deploy to zeabur button (songquanpeng#693) fix: numeric sorting in tables (songquanpeng#695) feat: sync pricing for new 1106 models (songquanpeng#696) docs: update readme chore: update quota calc logic (close songquanpeng#599) (songquanpeng#627) fix: fix Cloudflare AI Gateway channel test support (songquanpeng#639) feat: support chatglm_turbo (songquanpeng#648) fix: fix typo (songquanpeng#651)
greeeds
pushed a commit
to greeeds/one-api
that referenced
this issue
Mar 3, 2024
…#627) * fix: change quota calc code (close songquanpeng#599) Use float64 during calc and do math.Ceil after calc. This will result in the quota being used slightly more than the official standard, but it will be guaranteed that it will not be less. * chore: remove blank line --------- Co-authored-by: JustSong <songquanpeng@foxmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
例行检查
问题描述
在 API 调用的额度计算过程中,存在两次取整(舍去小数)操作,导致最终计算额度消耗略微偏小。
复现步骤
调用 API,查看后台日志:
实际消耗 $0.000338
该数值的计算方式为:
预期结果
按照公式,本次调用的消耗应为:
按照 OpenAPI 官方算法,本次调用的消耗应为:
The text was updated successfully, but these errors were encountered: