[codex] 新增每日 Token 用量统计脚本#29
Open
kts-kris wants to merge 5 commits into
Open
Conversation
1563a1f to
97ee063
Compare
97ee063 to
c2f6e3f
Compare
Author
|
补充同步一下:这个 PR 已更新到 v1.4.3,当前包含每日 Token 统计、近 5 日滚动存储、复用 Codex Token Usage、Model 价格/成本估算、趋势点悬停明细和分享图能力。\n\n本地已通过 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
变更说明
新增
Codex Daily Token Usage用户脚本,并登记到脚本市场清单。脚本能力:
Unknown的情况。Codex Token Usage的采集结果;当未安装或无法取得有效数据时,才启用内置轻量采集器,避免重复监听造成额外开销。localStorage占用。使用说明
如果环境中已安装并启用
Codex Token Usage,脚本会复用其window.__codexTokenUsage.export().turns数据,不再启动自身采集器。如果未安装
Codex Token Usage,或连续无法取得有效turn数据,脚本会自动启用内置轻量采集器,从fetch、XMLHttpRequest、WebSocket和postMessage中提取 Token 用量。统计数据仅保存在本机
localStorage,且只保留最近 5 日;分享图只包含 Token 汇总数据,不包含会话内容、项目路径或账号信息。成本只基于用户在本地配置的 Model 单价估算,不代表官方账单。缓存输入留空时按输入价计算,推理 Token 留空时按输出价计算。
市场清单
scripts/codex-daily-token-usage.js1.4.3890df2074a4ef0be3d424c86a21dca1ed1b9bd9a121dea112baa16fbb242d04a验证
jq empty index.jsonnode --check scripts/codex-daily-token-usage.jsindex.json中 SHA-256 与脚本文件一致