Skip to content

Usage and cost analytics view (per provider/model, 7/30/90-day ranges) #152

Closed

Description

@currentbits

What T3 Code does

A Usage page with a rolling-24h hourly chart, 7/30/90-day ranges, cost vs token toggle, provider shares, model breakdowns and cache savings (usage docs).

Solenta today

Per-thread token/cost numbers and a single "today vs budget" meter in the sidebar (src/components/Sidebar.tsx:2685-2691). The store keeps spendByDay totals (docs/ARCHITECTURE.md:97-99) with no breakdown view.

Why it matters

Users juggling five providers on subscriptions want "where did my quota go this week" per provider and per model. The data is largely already recorded in usageByThread; it just is not aggregated into a view.

Activity

  1. added
    enhancement
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 16, 2026
  2. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/usage-and-cost-analytics-view-per-provid-52e120 (two grok workers + orchestrator wiring).

    Store — new usageByDay { "YYYY-MM-DD": { provider: { model: { costUsd, inputTokens, outputTokens, turns } } } }, written by store.recordUsage() at the five existing usage sites (runner.js claude/codex/kimi/opencode + workflow.js) and pruned by the same 90-day retention as spendByDay. Recorded on tokens, not on cost, so subscription providers that bill $0 still show their quota burn. spendByDay and the budget meter are untouched.

    Wire — usage:byDay handler + preload + CoderApi.usage.byDay(), with the wireClient/devCoder/fakeCoder mirrors.

    View — new Usage nav row: 7/30/90 range toggle, cost/tokens toggle, CSS-only daily bar chart (no chart dep), provider shares, model table. Aggregation lives in pure src/usage.ts.

    Not built: the rolling-24h hourly chart (needs hourly buckets and its own retention) and cache savings (not reported uniformly across providers).

    Tests: 755 renderer pass, 883 electron pass (the 1 web-integration reconnect failure also fails on main), typecheck and build clean.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 17, 2026
  4. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Research note (Copilot PR outcome metrics, Devin/Replit cost-opacity complaints): extend the analytics view with (1) agent-PR outcome metrics: merge rate and median time-to-merge per provider, and (2) pre-flight cost estimates per task before dispatch (Copilot CLI /limits predict suggests a session budget from similar past sessions; cost opacity is the #1 complaint against Devin, Factory and Replit, so transparency here is differentiating).

  5. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Research note (Diffblue): adopt minutes-of-human-attention-per-thread as the north-star metric — 'setup only vs 510 minutes' is the category's most compelling number. Track human interventions per thread/automation and report outcomes (PRs merged autonomously, review cycles saved), not tokens.

  6. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Deep-dive implementation recipe (T3 PR #5684): read provider transcripts directly (~/.claude/projects/.jsonl, ~/.codex/sessions/.jsonl — catches turns driven outside Solenta too), price with LiteLLM's rate table cached 24h, aggregate server-side into (day, provider, model) buckets so raw transcripts never leave the machine, and flag unpriced models instead of zeroing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions