Skip to content

[Feature]: Session-Level AI Usage & Cost Tracking #8

Description

@vernonthedev

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I am describing a concrete problem or use case, not just a vague idea.

Area

Agent Runtime / Analytics / UI

Problem or Use Case

T3 Code supports multiple AI providers and models, but users currently have limited visibility into their actual usage during a session.

When working across different providers, it is difficult to answer questions such as:

  • How many tokens have been consumed?
  • Which provider is being used most?
  • Which model generated the most responses?
  • What is the estimated cost of the current session?
  • How much usage came from background agents versus the active agent?

Without this visibility, users cannot effectively manage costs or understand resource consumption.

Proposed Solution

Introduce a session-level usage dashboard that aggregates usage metrics across all providers and agents.

The dashboard should track:

  • Input tokens
  • Output tokens
  • Total tokens
  • Request count
  • Estimated cost
  • Model usage breakdown
  • Provider usage breakdown

Example UI

Session Usage

Provider          Requests     Tokens      Cost
------------------------------------------------
OpenAI            42           512,000     $3.12
Anthropic         18           214,000     $1.76
Google            9            67,000      $0.22

Total
------------------------------------------------
Requests: 69
Tokens: 793,000
Cost: $5.10

Additional Metrics

Per-agent statistics:

Agent A
- Requests: 24
- Tokens: 180k
- Cost: $1.12

Agent B
- Requests: 13
- Tokens: 96k
- Cost: $0.74

Per-model statistics:

Claude Sonnet
GPT-5
Gemini 2.5 Pro

Why This Matters

Benefits:

  • Better cost awareness
  • Easier provider comparison
  • Improved budgeting
  • Better visibility into agent behavior
  • More informed model selection

MVP Scope

Track:

  • Requests
  • Input tokens
  • Output tokens
  • Total tokens

Display:

  • Current session totals
  • Provider breakdown
  • Model breakdown

Estimated cost calculations can be added incrementally where provider pricing data is available.

Future Enhancements

  • Historical usage analytics
  • Daily/weekly/monthly reports
  • Export usage data
  • Team usage dashboards
  • Cost alerts and budgets

Acceptance Criteria

  • Usage is tracked per provider.
  • Usage is tracked per model.
  • Session totals are visible in the UI.
  • Metrics update in near real time.
  • Statistics reset appropriately when a session ends.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions