Conversation
…uryn#160) /api/data now ships each session a per-model token breakdown (by_model, grouped from turns), and a sessionCost() helper sums calcCost over it. Recent Sessions, Cost by Project, and Cost by Project & Branch previously billed a session's total tokens at its single primary model, so sub-agent turns on cheaper models were charged at the main model's rate. Falls back to primary-model pricing when the breakdown is empty (old DBs).
There was a problem hiding this comment.
Pull request overview
Adds per-model session pricing to correctly account for subagent usage.
Changes:
- Adds per-session model/token breakdowns to dashboard data.
- Uses model-specific pricing across session, project, branch, sorting, and CSV views.
- Adds mixed-model regression tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
dashboard.py |
Adds per-model breakdowns and session cost calculation. |
tests/test_dashboard.py |
Tests mixed-model token aggregation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sessionCost() prices each model in a session's by_model breakdown separately, so a session can be billable even when its primary model isn't (e.g. a non-billable main model that dispatched a billable sub-agent). The Recent Sessions table still gated its n/a display on isBillable(s.model) alone, so that real cost was computed but hidden. sessionIsBillable() checks the whole breakdown instead.
Owner
Author
|
Used this to trigger a Copilot review before submitting the real PR. It flagged a real inconsistency (sessionCost() vs. the n/a display gate), fixed in the follow-up commit. Closing without merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Throwaway PR to request a Copilot review of af61c29 before submitting to phuryn#165. Not intended to merge.