Repository navigation
tokenreceipt: Kilo Code token usage per model as a receipt at API list prices (reads kilo.db, local) #15035
henrikdukefoss
started this conversation in
4. Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If you use Kilo with your own API key, or on a Pass, and want the token totals per model priced at public API list prices, this reads Kilo's local data and prints them as a till receipt:
What it reads for Kilo (both generations):
${KILO_DB}, or~/.local/share/kilo/kilo.db(respectsXDG_DATA_HOME), using the samemessagetable as OpenCode. Reading the database needs Node 22.5+ (node:sqlite) or thesqlite3command.globalStorage/kilocode.kilo-code/tasks/. This is looked up for VS Code, Insiders, VSCodium, Cursor and Windsurf.legacyand zero tokens, so they aren't counted twice.Prices come from LiteLLM's public price table;
--offlineuses a bundled copy and makes no network request.--png/--svgwrites a shareable card and--jsonprints only the totals. Without--agentit puts Claude Code, Codex, OpenCode, Gemini CLI, Cline, Roo, Pi and Hermes on the same receipt.It complements Kilo's own per-session cost display: it adds everything up over a period and across agents. Nothing is uploaded; zero dependencies; MIT. https://github.com/henrikdukefoss/tokenreceipt
Disclosure: it's published by Standard Compute, the company I run (the receipt footer says so). Reports of a misread
kilo.dbare very welcome.All reactions