Repository navigation
fix(billing): count Anthropic cache tokens in consume log input totals #7305
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
Open
zhls-ayl
wants to merge
53
commits into
QuantumNous:main
Choose a base branch
from
zhls-ayl:fix/anthropic-consume-log-cache-tokens
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
4add2c5
fix(billing): count Anthropic cache tokens in consume log input totals
104902b
fix(logging): preserve OpenRouter input totals with split cache writes
zhls-ayl 9edffcc
Merge origin/main into fix/anthropic-consume-log-cache-tokens
05f4231
Merge fork OpenRouter consume log fix
c95446d
docs: add long-term fork maintenance prompt and tracking guide
bf9f411
Merge origin/main into fix/anthropic-consume-log-cache-tokens
d82cfd6
docs: record upstream sync and cross-database verification
7ce439e
Merge origin/main into fix/anthropic-consume-log-cache-tokens
c02bbb7
docs: record upstream sync of 633b4c5b1 and three-database verification
60327b1
docs: record upgrade-path verification and review follow-ups
d199ac1
Merge origin/main into fix/anthropic-consume-log-cache-tokens
654f356
test: cover cache-only Claude input in the consume log total
ca1d461
docs: record upstream sync of 718a4e7f9 and rc.44 upgrade verification
b1ae037
docs: record independent review findings for the 718a4e7f9 sync
1192757
docs: correct the read-only token auth note in the sync log
a1ef87f
Merge origin/main into fix/anthropic-consume-log-cache-tokens
cursoragent 591342c
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 662a689
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 9c14192
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent b2f94ac
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent b0fa168
Merge remote-tracking branch 'upstream/main' into fix/anthropic-consu…
cursoragent d2ea5d5
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent c41f159
Merge pull request #2 from zhls-ayl/cursor/sync-upstream-cache-tokens…
zhls-ayl aef6a15
Merge upstream QuantumNous/new-api main into fix/anthropic-consume-lo…
cursoragent 94b9e3c
Merge remote-tracking branch 'upstream/main' into fix/anthropic-consu…
cursoragent 104430c
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 8c6bfaa
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent c0b6e7c
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 67d9120
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 69f9b2d
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent eb19110
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 56c1e14
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent c435d70
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent b038c0a
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent f10c93c
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 4844996
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent ee72e44
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 724a2c8
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 0ba3fe7
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 33980cf
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 1afdba9
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent e4d282d
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent ecc11f8
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 14e40da
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent ba3e8c6
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent c66486b
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 0554188
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 6aae5d7
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent f9c83eb
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 2183bbf
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent e53d058
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 3840ba6
Merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent 5aa1d32
merge upstream/main into fix/anthropic-consume-log-cache-tokens
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # 长期维护分支:上游同步 Prompt | ||
|
|
||
| 将下面代码块完整复制到此仓库的新任务中。日常也可直接说: | ||
|
|
||
| > 按 `.agents/prompts/maintain-fork.md` 执行一轮上游同步,并更新 `docs/fork-maintenance.md`。 | ||
|
|
||
| ```text | ||
| 请在当前 new-api 仓库执行一轮长期维护分支的上游同步。 | ||
|
|
||
| 先读 AGENTS.md、docs/fork-maintenance.md,以及实际涉及目录的项目规范。 | ||
| 维护文档是补丁清单和历史记录;分支、remote、SHA、工具版本、测试状态必须现场核验。 | ||
| 默认维护分支是 fix/anthropic-consume-log-cache-tokens,源是 origin/main, | ||
| fork 是 zhls-ayl/new-api。不得把当前分支的 tracking branch 当成官方上游。 | ||
|
|
||
| 本次授权:fetch、只读分析、必要的隔离 worktree / 恢复引用、merge、 | ||
| 保持既有功能所必需的最小冲突修复、相关测试、维护记录更新及 scoped local commit。 | ||
| 默认不 push、不创建或评论 Issue/PR、不发布、不部署、不启动生产服务。 | ||
| 仅当我明确要求推送时,核验目标后普通 fast-forward push 到 fork 的维护分支。 | ||
| 不要修改 Git 身份、remotes、已有 tracking 配置或改写共享历史。 | ||
|
|
||
| 执行要求: | ||
| 1. 核对工作区、当前分支、所有 worktree、进行中的 Git 操作和两个 remote 的 URL。 | ||
| fetch 上游和 fork 后固定本轮目标 SHA,检查 fork 分支是否有本地未包含的提交。 | ||
| 不覆盖、不自动 stash 无关修改;能安全隔离则隔离,必须用户选择时再提出具体问题。 | ||
| 2. 先查重。目标已包含且没有待处理补丁或验证事项时,报告无新增改动,不制造空 merge。 | ||
| 3. 根据补丁清单逐项核验行为。区分“历史有此 commit”和“当前代码仍有此功能”。 | ||
| 对比本轮上游增量、维护分支相对目标的实际 tree diff,检查交叉改动和依赖链。 | ||
| 上游已实现等价功能时,用代码和行为测试证明后移除重复实现,保留必要回归覆盖并更新清单。 | ||
| 不能只凭标题、PR 状态、patch-id、文件无冲突或编译通过认定功能被保留或吸收。 | ||
| 4. 默认使用 merge,不 rebase / squash / reset 维护分支,不 force push。 | ||
| 记录合并前 SHA 并建立本地恢复引用;使用固定目标 SHA 合并,提交前检查合并结果。 | ||
| 禁止整文件使用 ours/theirs 解决业务冲突。保持本地补丁的业务契约,并纳入上游有效修复。 | ||
| 5. 优先使用 subAgents 并行做只读补丁审查及独立验证,保持单一 Git / 文件写入者。 | ||
| 若要实际修改认证、数据库、计费、前端或插件实现,先执行对应项目规范和 skill 要求。 | ||
| 6. 按维护文档运行本地补丁回归、root 与 relaykit 独立检查及受影响前端检查。 | ||
| 前端先 frozen-lockfile 安装、typecheck 和 build,补齐 web/dist 后再构建 root。 | ||
| 数据库行为受影响时必须执行真实 SQLite/MySQL/PostgreSQL 验证;检查 SKIP,不能把退出码 0 | ||
| 当成三数据库验证成功。缺少实例时如实记录阻塞,不能声明兼容性验证完成。 | ||
| 7. 测试失败先归因:合并回归、同环境上游失败、环境问题或疑似时序不稳定。 | ||
| 首轮失败和复跑结果都保留;不得删测、放宽断言、无依据调大 timeout 或反复重跑到绿。 | ||
| 发现稳定失败时,用固定上游 SHA 的隔离环境做最小对照;不顺手修复无关上游问题。 | ||
| 8. 明确区分 Git 已同步、补丁已验证、完整验证通过和可发布四种结论。 | ||
| 已证明的合并回归必须解决后再提交。仅缺环境或有证据的上游问题时,可保存本地同步结果, | ||
| 但必须列出验证缺口,不能作为已验证版本交付;这种例外不覆盖更严格的当前项目规则。 | ||
| 9. 按 docs/fork-maintenance.md 更新补丁状态和同步日志:前后/目标 SHA、冲突处理、 | ||
| 检查命令、工具及数据库版本、首轮/复跑结果、SKIP、证据位置、后续事项、推送状态。 | ||
| merge commit 后用独立 docs commit 记录其 SHA,避免自引用;所有提交只包含本任务文件。 | ||
| 文档只记录截至提交时已知的推送状态,最终 push SHA 回执留在回复和持久证据中,下轮补记。 | ||
| 10. 最终复核目标是维护分支 HEAD 的祖先、本地补丁行为、剩余 tree diff、工作区状态。 | ||
| 如已授权 push,额外核对 local HEAD、tracking ref 和远端实际 SHA 一致。 | ||
|
|
||
| 直接完成已授权步骤,不重复询问常规操作许可。只有凭现有证据无法决定、会丢失工作、 | ||
| 改变功能取舍或需要额外外部权限时才停下来说明具体分歧。 | ||
| 最终用中文简要报告同步提交、补丁状态、验证结论、未验证项及是否推送。 | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
将“所有提交”限定为本地非 merge 提交。
Line [47] conflicts with the authorized merge in Lines [15]-[16] and the required merge commit in
docs/fork-maintenance.mdLines [204]-[205]. A merge commit includes the upstream tree. This rule can cause the operator to omit upstream changes or block the required synchronization.建议修改
📝 Committable suggestion
🤖 Prompt for AI Agents