Skip to content

Fix usage accounting and refresh API pricing - #11

Merged
Gnonymous merged 1 commit into
mainfrom
codex/usage-pricing-update
Sep 27, 2026
Merged

Gnonymous merged 1 commit into
mainfrom
codex/usage-pricing-update

Conversation

@Gnonymous

Copy link
Copy Markdown
Owner

改动

  • Codex 优先读取逐请求 token_usage_record 并按响应 ID 去重;旧日志的首条及计数重置使用 last_token_usage,避免把跨文件累计基线计入用量。扫描缓存版本升至 9。
  • Claude 同一消息 ID 保留最终完整用量,修正流式输出 token 的低估。
  • 补齐 GPT-6 Astra/Sol/Luna、Claude Opus 5.5/Fable 5.1/Mythos 5.1 的标准 API 费率;修正 Sonnet 5 和 GPT-5.6 Sol 费率。未知版本保留模型 ID 并显示近似价格。
  • 模型归属改用日志来源;省钱建议按对应 Opus 型号动态计价。更新 README 和发布说明。

美元数值仍是标准 API 价格下的等价估算,不代表订阅实际扣费。本次未改动额度网络请求或 credits 展示。

验证

  • 本地 swift build --scratch-path /Users/gnonymous/Documents/Github/CodingBar/.build 通过。
  • 本地 CodingBar --self-test 全部通过,涵盖现有额度响应格式回归。
  • 对近 30 天真实日志,以独立脚本核对 Codex 和 Claude 的今日、7 天、30 天用量,记录数及输入、输出 token 总数均一致。
  • 新增真实格式的脱敏回归样本,覆盖累计基线、逐请求记录、重复记录、流式最终用量、模型归属、缓存和长上下文价格。
  • 本机仅有 Command Line Tools,XCTest 由现有 macOS/Xcode CI 执行。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b9f62e610

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +283 to +287
if modelID.hasPrefix("claude-opus-") { return priceTable["anthropic/claude-opus-5-5"]! }
if modelID.hasPrefix("claude-fable-") { return priceTable["anthropic/claude-fable-5-1"]! }
if modelID.hasPrefix("claude-mythos-") { return priceTable["anthropic/claude-mythos-5-1"]! }
if modelID.hasPrefix("claude-sonnet-") { return priceTable["anthropic/claude-sonnet-5"]! }
if modelID.hasPrefix("claude-haiku-") { return priceTable["anthropic/claude-haiku-4-5"]! }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize generation-first Claude model IDs

Historical Claude API IDs place the generation before the family, such as claude-3-opus-20240229 and claude-3-5-haiku-20241022. These new prefix checks do not recognize those IDs, so they now fall through to the generic $3/$15 fallback; previously the family matching selected the Opus or Haiku estimate. Consequently, existing transcripts can substantially underprice Opus usage or overprice Haiku usage. Match both official ID layouts, or explicitly alias these historical models before applying the generic fallback.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T15:41:14.064145Z 6b9f62e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Gnonymous
Gnonymous merged commit 1ffa105 into main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant