Skip to content

OpenClaw Source

The openclaw adapter reads OpenClaw agent transcripts:

  • ~/.openclaw/agents/**/*.jsonl
  • legacy homes: ~/.clawdbot/agents, ~/.moltbot/agents, ~/.moldbot/agents
Terminal window
llm-usage daily --source openclaw
llm-usage daily --openclaw-dir /path/to/.openclaw/agents
llm-usage daily --source-dir openclaw=/path/to/.openclaw/agents
  • Reads transcript JSONL rows recursively in deterministic path order.
  • Uses session rows for sessionId, timestamp, and cwd.
  • Tracks provider/model changes as later transcript rows update runtime state.
  • Emits only assistant messages with usage.
  • Preserves explicit usage.cost values when present.
  • Reads pi-style usage (input, output, cacheRead, cacheWrite), where input already excludes cache reads. For OpenAI Chat Completions prompt_tokens, which include cached input, cache reads are subtracted from input.
  • Falls back to the session row timestamp when an assistant usage row has no timestamp of its own, and skips the row otherwise (never the file mtime, which moves as the session grows).
  • Ignores non-usage user/system/tool rows and OpenClaw delivery-mirror assistant rows.