mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-30 07:37:40 +00:00
`bun run sessions` prints the most recently used pi sessions and what each
one cost, riding the same responseId join as link-session-logs.ts.
pi cannot price a session itself: the routstr provider in models.json has no
pricing table, so every assistant message carries usage.cost.total of 0. The
price is routstr's own billing event, appended to the upstream SSE stream and
therefore captured in responses/<id>.jsonl:
data: {"cost": {"total_msats": 221, "charged_msats": 221,
"total_usd": 0.00018576, ...}}
The scanner reads ids and cost from the raw log with escape-tolerant regexes
(the payload is JSON-escaped in the file), newest logs first, so it needs no
per-line JSON.parse and exits early once every id in play is priced.
Cross-checked per session against the daemon's usage_tracking table: identical
for OpenAI-style upstreams. For Anthropic the table is not usable — it stores
the raw request uuid as request_id while the session stores msg_<uuid> — so
the response logs are the reliable source.
Rows report priced/total turns, so aborted turns and pre-logging history stay
visible instead of silently deflating the total. Flags: --limit, --project,
--dir (falls back to requestResponseLogging.dir in config.json), --all, --json.
59 lines
1.7 KiB
JSON
59 lines
1.7 KiB
JSON
{
|
|
"name": "routstrd",
|
|
"version": "0.4.12",
|
|
"module": "src/index.ts",
|
|
"type": "module",
|
|
"private": false,
|
|
"bin": {
|
|
"routstrd": "./dist/index.js"
|
|
},
|
|
"files": [
|
|
"dist/index.js",
|
|
"dist/daemon/index.js",
|
|
"src",
|
|
"!src/**/*.test.ts",
|
|
"!src/daemon/wallet/fixtures",
|
|
"README.md",
|
|
"SECURITY.md",
|
|
"SKILL.md"
|
|
],
|
|
"scripts": {
|
|
"start": "bun src/index.ts start",
|
|
"stop": "bun src/index.ts stop",
|
|
"monitor": "bun src/index.ts monitor",
|
|
"lint": "tsc --noEmit",
|
|
"test": "bun test",
|
|
"smoke": "scripts/smoke/chat-completions.sh",
|
|
"link-logs": "bun scripts/link-session-logs.ts",
|
|
"sessions": "bun scripts/recent-sessions.ts",
|
|
"build": "bun build src/index.ts --target=bun --outfile=dist/index.js --external better-sqlite3 && bun build src/daemon/index.ts --target=bun --outfile=dist/daemon/index.js --external better-sqlite3",
|
|
"build:binary": "bun build --compile --no-compile-autoload-dotenv --no-compile-autoload-bunfig src/index.ts --outfile=dist/routstrd",
|
|
"prepublishOnly": "bun run build"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bun": "latest",
|
|
"@types/qrcode": "^1.5.6"
|
|
},
|
|
"peerDependencies": {
|
|
"typescript": "^5"
|
|
},
|
|
"dependencies": {
|
|
"@cashu/cashu-ts": "^4.3.0",
|
|
"@cashu/coco-core": "^1.0.1",
|
|
"@cashu/coco-sqlite-bun": "^1.0.1",
|
|
"@routstr/sdk": "^0.4.8",
|
|
"@scure/bip39": "^2.2.0",
|
|
"applesauce-core": "^5.1.0",
|
|
"applesauce-relay": "^5.1.0",
|
|
"applesauce-wallet-connect": "^6.0.0",
|
|
"coco-cashu-core": "1.1.2-rc.50",
|
|
"coco-cashu-plugin-npc": "2.4.1",
|
|
"commander": "^14.0.2",
|
|
"nostr-tools": "^2.12.0",
|
|
"qrcode": "^1.5.4",
|
|
"rxjs": "^7.8.1",
|
|
"yaml": "^2.9.0",
|
|
"zustand": "^5.0.5"
|
|
}
|
|
}
|