Skip to content

Add granular session-log usage diagnostics (date ranges + JSON export) #3718

@joeerario

Description

@joeerario

Problem

  • Usage can spike, but current UX is coarse: /usage cost is a fixed 30-day summary and /usage only shows per-response footers. Provider quota snapshots do not explain where tokens went.
  • The only deeper option today is manual jq against session logs (skills/session-logs).

Proposal (small, aligned steps)

  1. Extend the existing session-log aggregator (src/infra/session-cost-usage.ts) to accept date ranges/--days and emit JSON.
  2. Expose via CLI: moltbot usage cost --days N --json --agent all.
  3. Optional: add per-session/per-model breakdown flags once the core is agreed.

Value

  • Concrete diagnostics for token spikes without provider OAuth.
  • Works across providers (Claude 4.5 / Gemini 3 Flash / MiniMax 2.1).
  • Exportable for budgeting and dashboards.

If this direction makes sense, I can follow up with a small PR limited to steps (1) and (2), then iterate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions