Repository navigation
feat(insights): count AI token usage and show it in an AI usage tab #5823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+15,450
−85
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
12f5ec1
feat(insights): count AI token usage and show it in an AI usage tab
Rhainland c72f61d
fix(insights): keep the AI chart's overflow band apart from the Other…
Rhainland d2e112e
fix(insights): count only usable or billed embedding replies, under t…
Rhainland 0417772
fix(insights): count an unbilled embedding reply only after its vecto…
Rhainland 00b2585
Merge main into feat/ai-usage-insights
Quick104 74fb97e
fix(insights): take the AI usage tracking day in UTC whatever the dat…
Quick104 fbcd117
fix(insights): send the AI usage tracking day as a date, and label un…
Quick104 823805a
fix(insights): never fail a provider reply over its usage field
Quick104 e8f439c
chore(web): sync the AI usage strings in every language from silo-tra…
Quick104 220b9c3
Merge main into feat/ai-usage-insights
Quick104 ffeae8b
fix(insights): read a provider's token count without a swallowed error
Rhainland b1e5ddd
Merge origin/main into feat/ai-usage-insights
Quick104 0ff4282
fix(insights): keep a malformed usage field from rejecting embedding …
Quick104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| platform=web | ||
| version=2026.12.03-df4da74 | ||
| sha256=a1ef155b18b453fbe1e108447c8bcfe77037997847da3f469b3f36c61c91b051 | ||
| version=local-e36f5854cb9d | ||
| sha256=- | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "from": "2025-12-04T03:04:05.678Z", | ||
| "to": "2026-01-02T03:04:05.678Z", | ||
| "tracking_since": "2025-11-23T03:04:05.678Z", | ||
| "summary": { | ||
| "requests": 848, | ||
| "input_tokens": 1640000, | ||
| "cached_input_tokens": 610000, | ||
| "output_tokens": 1280000, | ||
| "total_tokens": 2920000, | ||
| "audio_seconds": 14400 | ||
| }, | ||
| "models": [ | ||
| { | ||
| "requests": 812, | ||
| "input_tokens": 1640000, | ||
| "cached_input_tokens": 610000, | ||
| "output_tokens": 1280000, | ||
| "total_tokens": 2920000, | ||
| "audio_seconds": 0, | ||
| "key": "openai-1/gpt-5-mini", | ||
| "provider_id": "openai-1", | ||
| "provider_name": "OpenAI", | ||
| "provider_type": "openai", | ||
| "model": "gpt-5-mini" | ||
| }, | ||
| { | ||
| "requests": 36, | ||
| "input_tokens": 0, | ||
| "cached_input_tokens": 0, | ||
| "output_tokens": 0, | ||
| "total_tokens": 0, | ||
| "audio_seconds": 14400, | ||
| "key": "groq-1/whisper-large-v3-turbo", | ||
| "provider_id": "groq-1", | ||
| "provider_name": "Groq", | ||
| "provider_type": "groq", | ||
| "model": "whisper-large-v3-turbo" | ||
| } | ||
| ], | ||
| "features": [ | ||
| { | ||
| "requests": 812, | ||
| "input_tokens": 1640000, | ||
| "cached_input_tokens": 610000, | ||
| "output_tokens": 1280000, | ||
| "total_tokens": 2920000, | ||
| "audio_seconds": 0, | ||
| "feature": "subtitle_translation", | ||
| "models": [ | ||
| "gpt-5-mini" | ||
| ] | ||
| }, | ||
| { | ||
| "requests": 36, | ||
| "input_tokens": 0, | ||
| "cached_input_tokens": 0, | ||
| "output_tokens": 0, | ||
| "total_tokens": 0, | ||
| "audio_seconds": 14400, | ||
| "feature": "transcription", | ||
| "models": [ | ||
| "whisper-large-v3-turbo" | ||
| ] | ||
| } | ||
| ], | ||
| "points": [ | ||
| { | ||
| "date": "2026-01-02", | ||
| "input_tokens": 1640000, | ||
| "output_tokens": 1280000, | ||
| "tokens_by_model": { | ||
| "openai-1/gpt-5-mini": 2920000 | ||
| }, | ||
| "tokens_by_feature": { | ||
| "subtitle_translation": 2920000 | ||
| } | ||
| } | ||
| ] | ||
| } |
5 changes: 3 additions & 2 deletions
5
contracts/api/v2/fixtures/get_admin_insights_capabilities_ok.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| { | ||
| "revision": "c15bec2f7888e7c57ea3349e2c03dce235defdff41c13fe60f105fe2abadd16a", | ||
| "revision": "d8fd0a1759b2d49466df6a05d9c6689d5bdb9664ff5e3138324eef4b51544a00", | ||
| "state": "available", | ||
| "allowed": true, | ||
| "available": true, | ||
| "node_egress_daily": true, | ||
| "titles": true, | ||
| "profile_filter": true, | ||
| "library": true, | ||
| "breakdowns": true | ||
| "breakdowns": true, | ||
| "ai_usage": true | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.