Telemetry
SQL recipe collection

AI and LLM SQL recipes

Connect token usage, model cost, cache behavior, latency, tool reliability, and accepted outcomes for AI product workflows.

Beginnerllm_requests

Calculate LLM Cost by Feature and Model

Attribute model spend, tokens, request volume, and cost per request to product features.

See SQL and result
Intermediatellm_requests

Measure Accepted AI Outputs per Dollar

Connect model spend to accepted, saved, or otherwise useful product outcomes.

See SQL and result
Intermediatellm_requests

Measure LLM Cache Savings and Retry Cost

Compare cached requests, retry volume, and estimated spend by model to find avoidable AI cost.

See SQL and result

Adapt the event contract before the threshold

Keep the analysis pattern, but validate table names, field types, business definitions, time windows, and minimum-volume rules against your own events.

SQL reference