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
Copy file name to clipboardExpand all lines: .server-changes/llm-cost-tracking.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,4 @@ area: webapp
3
3
type: feature
4
4
---
5
5
6
-
Add automatic LLM cost calculation for spans with GenAI semantic conventions. When a span arrives with `gen_ai.response.model` and token usage data, costs are calculated from an in-memory pricing registry backed by Postgres and dual-written to both span attributes (`trigger.llm.*`) and a new `llm_usage_v1` ClickHouse table.
6
+
Add automatic LLM cost calculation for spans with GenAI semantic conventions. When a span arrives with `gen_ai.response.model` and token usage data, costs are calculated from an in-memory pricing registry backed by Postgres and dual-written to both span attributes (`trigger.llm.*`) and a new `llm_metrics_v1` ClickHouse table that captures usage, cost, performance (TTFC, tokens/sec), and behavioral (finish reason, operation type) metrics.
Copy file name to clipboardExpand all lines: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/ExamplesContent.tsx
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -126,25 +126,25 @@ LIMIT 100`,
126
126
SUM(total_cost) AS total_cost,
127
127
SUM(input_tokens) AS input_tokens,
128
128
SUM(output_tokens) AS output_tokens
129
-
FROM llm_usage
129
+
FROM llm_metrics
130
130
WHERE start_time > now() - INTERVAL 7 DAY
131
131
GROUP BY response_model
132
132
ORDER BY total_cost DESC`,
133
133
scope: "environment",
134
-
table: "llm_usage",
134
+
table: "llm_metrics",
135
135
},
136
136
{
137
137
title: "LLM cost over time",
138
138
description: "Total LLM cost bucketed over time. The bucket size adjusts automatically.",
139
139
query: `SELECT
140
140
timeBucket(),
141
141
SUM(total_cost) AS total_cost
142
-
FROM llm_usage
142
+
FROM llm_metrics
143
143
GROUP BY timeBucket
144
144
ORDER BY timeBucket
145
145
LIMIT 1000`,
146
146
scope: "environment",
147
-
table: "llm_usage",
147
+
table: "llm_metrics",
148
148
},
149
149
{
150
150
title: "Most expensive runs by LLM cost (top 50)",
Copy file name to clipboardExpand all lines: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx
0 commit comments