Skip to content

Kimi Code 0.14 usage is not detected from ~/.kimi-code usage.record logs #1261

Description

@arittr

ccusage currently reports no Kimi usage even though Kimi Code has local usage rows.

Environment:

  • ccusage latest on npm: 20.0.11
  • Kimi Code: 0.14.0
  • macOS arm64

I tested the latest published native ccusage binary directly from npm:

ccusage --version
# ccusage 20.0.11

KIMI_DATA_DIR="$HOME/.kimi-code" ccusage kimi daily --json --offline

Actual:

{"daily":[],"totals":{"cacheCreationTokens":0,"cacheReadTokens":0,"inputTokens":0,"outputTokens":0,"totalCost":-0.0,"totalTokens":0}}

But Kimi Code stores usage here:

~/.kimi-code/sessions/<workDirKey>/<sessionId>/agents/<agentId>/wire.jsonl

Those files contain usage rows like:

{"type":"usage.record","time":1781055528344,"usage":{"inputOther":4099,"inputCacheRead":6400,"inputCacheCreation":0,"output":101}}

A sanitized local count found nonzero usage:

wire.jsonl files: 133
files with usage.record: 128
usage_record_rows=1935
inputOther=4468921
inputCacheRead=94629376
inputCacheCreation=0
output=839371

I also checked current upstream source/docs. The Kimi adapter still appears to target the legacy layout/schema:

  • default path: ~/.kimi
  • discovered path shape: sessions/<group>/<session>/wire.jsonl
  • parsed rows: StatusUpdate with payload.token_usage.input_other, output, input_cache_read, etc.

Relevant lines:

This seems distinct from pricing-only Kimi fixes because usage is never loaded.

Prior reports with the same diagnosis were auto-closed by the new-contributor gate:

Expected:
ccusage should discover modern Kimi Code logs under ~/.kimi-code/sessions/*/*/agents/*/wire.jsonl and parse usage.record rows with camelCase usage fields.

Likely fix:

  • add ~/.kimi-code as a default Kimi data root, while preserving KIMI_DATA_DIR
  • accept sessions/<workspace>/<session>/agents/<agent>/wire.jsonl
  • parse usage.record rows using usage.inputOther, usage.inputCacheRead, usage.inputCacheCreation, and usage.output
  • treat time as milliseconds
  • extract the session id from the <session> path component
  • normalize any kimi-code/ model prefix before pricing lookup

Activity

  1. github-actions commented on Jun 11, 2026

    @github-actions
    Contributor

    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 replies lgtm, your future issues and PRs will stay open.

    See CONTRIBUTING.md.

  2. M1nt-Ch0c0 commented on Jun 22, 2026

    @M1nt-Ch0c0
    Contributor

    @ryoppippi could this be reopened? Still reproducible on v20.0.14 (details below).

    I'm still seeing this on ccusage 20.0.14.

    I reproduced it in two separate environments, each with its own Kimi data directory:

    1. Windows: %USERPROFILE%.kimi-code
    2. WSL / Arch Linux: /home//.kimi-code

    The behavior is the same in both places:

    $ ccusage --version
    20.0.14
    
    # default (reads ~/.kimi, old kimi-cli format) — works
    $ ccusage kimi daily          # OK, but only old data up to my migration date
    
    # pointing at the new Kimi Code dir — nothing
    $ KIMI_DATA_DIR=~/.kimi-code ccusage kimi daily
    No usage data found.
    

    On my WSL install, ~/.kimi-code contains 137 usage.record turn events across 84 wire.jsonl files. My Windows install has 1198 such events. In both cases, ccusage reports no usage data.

    From the files I have locally, Kimi Code appears to use a different wire format from the older kimi-cli format that the current adapter supports.

    Current Kimi Code layout:

    ~/.kimi-code/sessions/<workspace>/session_<uuid>/agents/main/wire.jsonl
    ~/.kimi-code/sessions/<workspace>/session_<uuid>/agents/agent-0/wire.jsonl
    

    Example Kimi Code usage event:
    {"type":"usage.record","model":"kimi-code/kimi-for-coding","usage":{"inputOther":3064,"output":76,"inputCacheRead":14848,"inputCacheCreation":0},"usageScope":"turn","time":1782113184943}
    The older format currently parsed by the adapter looks like this:
    {"timestamp": 1780046636.6985204, "message": {"type": "StatusUpdate", "payload": {"token_usage": {"input_other": 7190, "output": 200, "input_cache_read": 5888, "input_cache_creation": 0}}}}

    The main differences I noticed are:

    • data directory changed from ~/.kimi to ~/.kimi-code
    • path depth changed to include agents//wire.jsonl
    • usage events are now type: "usage.record"
    • usage fields changed from snake_case to camelCase
    • timestamps are now milliseconds instead of seconds
    • model names now use the kimi-code/ prefix
    • usageScope: "turn" appears to be the per-turn delta
    • usageScope: "session" appears to be cumulative and should probably be ignored to avoid double counting

    Issues #1246 / #1247 / #1261 seem related, but they are closed, and I couldn't find a merged PR or commit on main that adds support for this newer Kimi Code format.
    Would you be open to reopening this, or tracking Kimi Code support separately?I can share sample wire.jsonl data if that helps.

  3. ryoppippi commented on Jun 22, 2026

    @ryoppippi
    Member

    send a pr plz! i don't personally use kimi code

  4. M1nt-Ch0c0 commented on Jun 22, 2026

    @M1nt-Ch0c0
    Contributor

    send a pr plz! i don't personally use kimi code

    @ryoppippi Hi, I've fixed this issue and here's the PR.#1362
    Could you please review it and reply lgtm so the PR can go through?

  5. M1nt-Ch0c0 commented on Jun 25, 2026

    @M1nt-Ch0c0
    Contributor

    @ryoppippi I opened PR #1362 as requested for this Kimi Code fix, but it was auto-closed by the new-contributor gate. Validation (just fmt, just typecheck, just test) passed. Could you please reopen or reply lgtm if it looks OK?

  6. ryoppippi commented on Aug 31, 2026

    @ryoppippi
    Member

    Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.

    Audit result: resolved. A later merged change or the current main implementation covers this request. This item is kept for history and does not need to be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage:resolvedResolved by a later change or current implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions