Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .silo-translations
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
platform=web
version=2026.12.04-d577fe4
sha256=417f4a4d858ae2ea8ae1133b2a4d3c1fef1827ec6e53a7e872f458cd4855b34e
version=local-42f8bf173f6c
sha256=-
4 changes: 3 additions & 1 deletion cmd/silo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/Silo-Server/silo-server/internal/access"
"github.com/Silo-Server/silo-server/internal/activitylog"
"github.com/Silo-Server/silo-server/internal/adminjob"
aiusage "github.com/Silo-Server/silo-server/internal/ai/usage"
"github.com/Silo-Server/silo-server/internal/animeids"
"github.com/Silo-Server/silo-server/internal/api"
"github.com/Silo-Server/silo-server/internal/api/handlers"
Expand Down Expand Up @@ -3215,7 +3216,8 @@ func main() {
userStoreProvider,
cfg.Recommendations,
).WithUnratedContentPolicy(unratedContent).
WithUserStoreOutsidePostgres(cfg.UserDB.Backend == "sqlite")
WithUserStoreOutsidePostgres(cfg.UserDB.Backend == "sqlite").
WithUsageRecorder(aiusage.NewStore(deps.DB, slog.Default()))
if userStoreProvider != nil {
// Cached rows are built under the scope the API resolves for the
// profile's own requests, so reads do not filter them down.
Expand Down
80 changes: 80 additions & 0 deletions contracts/api/v2/fixtures/get_admin_insights_ai_ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"from": "2025-12-04T00:00:00.000Z",
"to": "2026-01-02T03:04:05.678Z",
"tracking_since": "2025-11-23",
"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
}
}
]
}
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
}
23 changes: 22 additions & 1 deletion contracts/api/v2/fixtures/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -6765,6 +6765,27 @@
"schema": "#/components/schemas/AdminInsightsActivity",
"body_file": "get_admin_insights_activity_ok.json"
},
{
"name": "get_admin_insights_ai_ok",
"operation_id": "getAdminInsightsAI",
"scenario": "Administrator insights AI usage returns token and audio totals per model, feature and UTC day.",
"request": {
"method": "GET",
"path": "/api/v2/admin/insights/ai?range=30d",
"headers": {
"Authorization": "Bearer tok-admin",
"X-Profile-Id": "p-primary"
}
},
"expected_status": 200,
"response_headers": {
"Cache-Control": "no-store",
"Content-Type": "application/json"
},
"response_media_type": "application/json",
"schema": "#/components/schemas/AdminInsightsAI",
"body_file": "get_admin_insights_ai_ok.json"
},
{
"name": "get_admin_insights_bandwidth_ok",
"operation_id": "getAdminInsightsBandwidth",
Expand Down Expand Up @@ -6802,7 +6823,7 @@
"response_headers": {
"Cache-Control": "private, no-cache",
"Content-Type": "application/json",
"ETag": "\"ea9d806298fc07f74f668bef1fafe6cb0204503eb347122814111a4e25688ccc\""
"ETag": "\"28557ec14946924c708f540561fff32f88b5aaa61e795d84dcd7a454112804fc\""
},
"response_media_type": "application/json",
"schema": "#/components/schemas/AdminInsightsCapabilities",
Expand Down
Loading
Loading