You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add friendlyId to LlmModel, TRQL llm_usage integration, and seed-on-startup
- Add friendly_id column to llm_models (llm_model_xxx format)
- Use friendlyId as matchedModelId in all external surfaces
- Add durationNs render type to TSQLResultsTable and QueryResultsChart
- Add 4 example queries for llm_usage in query editor
- Add LLM_PRICING_SEED_ON_STARTUP env var for local bootstrapping
- Update admin API and seed to generate friendlyId
refs TRI-7773
Copy file name to clipboardExpand all lines: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/ExamplesContent.tsx
+57Lines changed: 57 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,63 @@ LIMIT 100`,
118
118
scope: "environment",
119
119
table: "metrics",
120
120
},
121
+
{
122
+
title: "LLM cost by model (past 7d)",
123
+
description: "Total cost, input tokens, and output tokens grouped by model over the last 7 days.",
124
+
query: `SELECT
125
+
response_model,
126
+
SUM(total_cost) AS total_cost,
127
+
SUM(input_tokens) AS input_tokens,
128
+
SUM(output_tokens) AS output_tokens
129
+
FROM llm_usage
130
+
WHERE start_time > now() - INTERVAL 7 DAY
131
+
GROUP BY response_model
132
+
ORDER BY total_cost DESC`,
133
+
scope: "environment",
134
+
table: "llm_usage",
135
+
},
136
+
{
137
+
title: "LLM cost over time",
138
+
description: "Total LLM cost bucketed over time. The bucket size adjusts automatically.",
139
+
query: `SELECT
140
+
timeBucket(),
141
+
SUM(total_cost) AS total_cost
142
+
FROM llm_usage
143
+
GROUP BY timeBucket
144
+
ORDER BY timeBucket
145
+
LIMIT 1000`,
146
+
scope: "environment",
147
+
table: "llm_usage",
148
+
},
149
+
{
150
+
title: "Most expensive runs by LLM cost (top 50)",
151
+
description: "Top 50 runs by total LLM cost with token breakdown.",
152
+
query: `SELECT
153
+
run_id,
154
+
task_identifier,
155
+
SUM(total_cost) AS llm_cost,
156
+
SUM(input_tokens) AS input_tokens,
157
+
SUM(output_tokens) AS output_tokens
158
+
FROM llm_usage
159
+
GROUP BY run_id, task_identifier
160
+
ORDER BY llm_cost DESC
161
+
LIMIT 50`,
162
+
scope: "environment",
163
+
table: "llm_usage",
164
+
},
165
+
{
166
+
title: "LLM calls by provider",
167
+
description: "Count and cost of LLM calls grouped by AI provider.",
0 commit comments