feat(usage-stats): 用量统计新增模型维度聚合,区分请求模型与实际模型#3
Merged
Conversation
query_daily() 查询按 model_requested/model_served 分组,CLI 表格新增 「请求模型」「实际模型」两列,并支持 --model 参数按请求模型过滤。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
概述
coding-proxy usage命令原先仅按 日期 + 后端 聚合统计,无法区分具体使用了哪个模型。本次变更在查询层、展示层和 CLI 层新增模型维度支持,使用户能清晰看到每个请求模型(model_requested)和实际服务模型(model_served)的独立用量。变更内容
查询层(
logging/db.py)query_daily()的 SQL 增加model_requested、model_served字段的SELECT和GROUP BYmodel可选参数,支持按请求模型过滤展示层(
logging/stats.py)model过滤参数CLI 层(
cli.py)usage命令新增--model / -m选项,按model_requested过滤测试(
tests/test_token_logger.py)预期效果
验证