ACP adapter does not report token usage (PromptResponse.usage empty, no usage_update emitted)
Summary
Kimi Code's ACP adapter does not report token usage to ACP clients. The PromptResponse.usage field is left empty and no usage_update events are emitted on turn.ended. This causes downstream ACP clients (e.g., Multica, OpenCode, Claude Code running kimi as backend) to have zero visibility into token consumption and cost.
Impact
-
Breaking for external orchestration platforms. Multica's
runtime usagecommand shows zero rows for Kimi runtime, while Claude/OpenAI runtimes on the same daemon return full per-model breakdowns. Cost calibration autopilots that read usage data permanently skip Kimi agents. -
The data exists internally. Kimi Code's internal SDK tracks usage via
session.getUsage()and serializes it towire.jsonl(inputOther/output/inputCacheRead/inputCacheCreation). It just never crosses the ACP boundary. -
Old Python kimi-cli had the same bug. kimi-cli#2394 reported the identical issue in the legacy Python codebase. This is a known gap.
Root Cause
In packages/acp-adapter/src/session.ts, the turn.ended handler resolves with only stopReason:
// Current (v0.26.0):
resolve({ stopReason: ... })
// No PromptResponse.usage filled
// No usage_update event emitted
The ACP protocol supports two paths for usage reporting:
PromptResponse.usage— maps directly toTurnResponseand is consumed by Multica's kimi adapter (kimi.go L305–L385).session/updatewithusage_update— parsed by the shared ACP client with camelCase/snake_case compatibility (hermes.go L988–L1058).
Either path, if filled, would be picked up by existing downstream code immediately—no changes needed in Multica or other ACP consumers.
Proposed Fix
In the turn.ended handler (or a new prompt.ended handler), call session.getUsage() and populate PromptResponse.usage:
const usage = session.getUsage()
resolve({
stopReason: ...,
usage: {
inputTokens: usage.inputTokens,
outputTokens: usage.outputTokens,
// cache fields if tracked:
// cacheReadInputTokens: usage.inputCacheRead,
// cacheCreationInputTokens: usage.inputCacheCreation,
}
})
Alternatively (or additionally), emit a usage_update via session/update notification.
Steps to Reproduce
- Run kimi-code v0.26.0 in ACP mode (
kimi acp) - Complete any turn (simple prompt or tool-calling turn, doesn't matter)
- Observe the
promptresponse —usagefield is absent or empty - Compare with Claude Code / OpenCode in ACP mode — both fill
usageon every turn
Environment
- kimi-code: 0.26.0 (Nix-installed on macOS ARM64, Node.js v24.18.0)
- ACP protocol version: 1.4
- Model: k3 (also reproducible with kimi-for-coding)
Related
- kimi-cli#2394 — same issue in legacy Python codebase
- Multica adapter ready to consume: kimi.go#L305-L385
Still reproduces on Kimi Code CLI 0.31.1 (this was filed against 0.26.0), so it has survived several releases.
Probe
Raw NDJSON JSON-RPC straight to kimi acp over stdio — no client framework involved, so nothing downstream can be blamed. One full turn (initialize → session/new → session/prompt), logging every session/update notification:
agent_thought_chunk: 20
available_commands_update: 1
agent_message_chunk: 1
usage_update: 0 <--
And the prompt result itself:
{"stopReason": "end_turn", "usage": null}
So both ACP paths described in the original report are still empty: no usage_update notification, and PromptResponse.usage is null.
initialize reports agentInfo: {"name": "Kimi Code CLI", "version": "0.31.1"}, and agentCapabilities advertises no usage capability.
The numbers do exist internally
The shipped binary contains a mapper that pulls context-window figures out of the internal session object:
function UE(e){return{
inputTokens: e.input_tokens, outputTokens: e.output_tokens,
cacheReadTokens: e.cache_read_tokens, cacheCreationTokens: e.cache_creation_tokens,
totalCostUsd: e.total_cost_usd,
contextTokens: e.context_tokens, contextLimit: e.context_limit,
turnCount: e.turn_count }}
contextTokens / contextLimit map cleanly onto ACP's UsageUpdate.used / UsageUpdate.size. The data is already tracked per session — it just never crosses the ACP boundary.
Downstream impact (another affected client)
In Paseo this leaves the composer's context-window meter as a dead gray circle for every Kimi session. It's worse than a missing number: Paseo nests its provider-quota panel inside that meter's tooltip, and the tooltip is never mounted when token counts are null — so the 5h/weekly quota readout is unreachable too, even though Paseo's Kimi quota fetcher works fine against live credentials.
Paseo has a matching issue for its side of the gap (getpaseo/paseo#1390 — it drops usage_update when one is sent), but that one is moot for Kimi until Kimi emits the frames in the first place. Filling either path here would light up multiple clients at once.
Environment: Arch Linux x86_64, Kimi Code CLI 0.31.1, probe run directly against kimi acp.