feat(usage): prioritize auto_model from metadata in usage queries#2214
Merged
chrarnoldus merged 1 commit intomainfrom Apr 9, 2026
Merged
Conversation
Update usage queries to select auto_model from microdollar_usage_metadata before falling back to requested_model and model. This affects: - src/app/api/profile/usage/route.ts - src/routers/organizations/organization-usage-details-router.ts
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 205,834 tokens |
Contributor
|
if there's a perf issue we'll just revert it |
imanolmzd-svg
approved these changes
Apr 9, 2026
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.
Summary
Update usage queries to prioritize
auto_modelfrommicrodollar_usage_metadatawhen selecting the model name, falling back torequested_modeland thenmodelfrommicrodollar_usage.Changes
Modified
apps/web/src/app/api/profile/usage/route.ts:microdollar_usage_metadataandauto_modeltablesauto_model.auto_modelbeforerequested_modelandmodelModified
apps/web/src/routers/organizations/organization-usage-details-router.ts:microdollar_usage_metadataandauto_modeltablesgetTimeSeriesquery to prioritizeauto_modelgetquery to prioritizeauto_modelVerification
pnpm typecheckpassespnpm lintpassespnpm formatappliedVisual Changes
N/A - Backend query changes only
Reviewer Notes
The model selection priority is now:
auto_model.auto_model(from metadata)microdollar_usage.requested_modelmicrodollar_usage.modelThis ensures that when auto-model selection is used, the actual model that was selected is displayed in usage reports rather than the requested model.
Generated by: moonshotai/kimi-k2.5