Repository navigation
Description
What do you want to change?
While working with ccusage, my Kimi code usage wasn't picked up. I found that the one shipped looks in a directory that isn't available and that it looks for a different structure than what 0.14.0 is using.
The bigger issue, though, is that even if you pointed it at ~/.kimi-code with the env var, it still wouldn't work because the parser was built for a completely different wire format. It expected:
{"message":{"type":"StatusUpdate","payload":{"token_usage":{"input_other":100,"output":50}}}} But Kimi Code CLI writes:
{"type":"usage.record","usage":{"inputOther":100,"output":50},"time":1780925702183} Why?
This Adds kimi code results with proper lookup and costs.
How? (optional)
The fix extends the existing Kimi adapter to recognize both the legacy wire format and Kimi Code CLI's format.
-
Path resolution: search ~/.kimi-code in addition to ~/.kimi, and accept the deeper path nesting sessions/{workspace}/{session}/agents/{agent}/wire.jsonl.
-
Parser: handle two event shapes in the same wire file:
• Legacy StatusUpdate with snake_case token_usage fields and second-based timestamps
• Kimi Code CLI usage.record with camelCase usage fields (inputOther, inputCacheRead, etc.) and millisecond timestamps -
Model mapping: strip the kimi-code/ prefix from model names so pricing lookups resolve correctly.
-
Session extraction: walk up from the sessions directory component so the session ID is correct for both flat and deep directory layouts.
Activity
pullfrog commentedon Jun 10, 2026
github-actions commentedon Jun 10, 2026
This issue was auto-closed. Issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.
Keep the issue short, concrete, and written in your own voice.
If a maintainer replies
lgtmi, your future issues will stay open. If a maintainer replieslgtm, your future issues and PRs will stay open.See CONTRIBUTING.md.
nathanAtHeadfwd commentedon Jun 12, 2026
https://github.com/ccusage/ccusage/compare/main...nathanAtHeadfwd:ccusage:fix/kimi-code-cli-support?w
I have the fix for it here. Has been working on my machine for a few days now. If you want me to make a PR, just let me know.
ryoppippi commentedon Aug 31, 2026
Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.
Audit result: maintainable candidate. The request fits the current ccusage scope and can be evaluated with repository-owned code or fixtures, without vendor credentials or platform-specific release infrastructure. It remains closed for now; reopen only after confirming current relevance and expected behavior.