AI Cost Analytics Dashboard

AI Cost Analytics Dashboard

A production attribution layer that traces every AI generation (text, image, audio, video) back to the content it produced, the model that created it, what it cost, and how it performed. Built on two cost ledgers, one for LLM calls (Gemini and Anthropic) and one for media APIs (ElevenLabs, Replicate, Modal), joined in the dashboard. The LLM ledger holds 33,850 calls.

  • typescript
  • nextjs
  • supabase
  • vercel
Performance Tab

Performance Tab

Content Economics

Content Economics

Why This Exists

When you run AI across dozens of tasks (article rewrites, image generation, audio synthesis, social captions, newsletter content), you need more than logs. You need attribution. Every generation should answer: what model produced this, what content did it feed into, what did it cost, and how long did it take?

This dashboard is the answer. It sits on top of two cost ledgers, llm_calls for every LLM call and api_costs for media APIs, and gives operational, financial, and editorial visibility into the entire pipeline.

The Attribution Layer

The foundation is a simple principle: every AI generation gets a record. Every single call writes a row with:

  • What: The generation type (article rewrite, image brief, FAQ schema, social caption, audio narration)
  • Where: Which model and provider produced it (Gemini, Anthropic, ElevenLabs, Replicate)
  • When: Timestamp, latency, and execution context
  • Why: The source article, content category, and pipeline step that triggered it

This creates a complete chain of custody from raw source material → AI generation → published content. When an article goes live, you can trace every generation that contributed to it: the classification, the research enrichment, the rewrite, the image, the social posts. You know exactly what each step cost.

Three Lenses

The dashboard surfaces this data through three tabs:

  • Spend: Total AI spend (LLM + media), daily cost trends, cost by model, cost by provider. Tracks budget burn and identifies which providers drive the most spend.
  • Performance: Average and P95 latency per task, throughput (tokens/second), input vs. output cost ratio, token efficiency by model. Identifies slow tasks and inefficient models before they become bottlenecks.
  • Content: Per-article cost, total content cost, tokens per article, cost by content product, cost by editorial category. Connects AI spend to business output and the unit economics of content production.

Engineering Decisions

  • Ledger over sampling: Every LLM call writes a row to llm_calls, so cost per article is summed from recorded calls rather than projected from a sample, which is the number a budget decision needs.
  • Two ledgers, one view: LLM calls and media API costs land in separate tables, and the dashboard joins them, so a Gemini rewrite and an ElevenLabs narration sit on the same per-article bill.
  • Content-joined economics: The Content tab joins generations to articles, giving a true unit economics view. An article that costs $0.07 to produce tells a different story than one that costs $1.65.
  • Time-windowed queries: 7d, 30d, 90d, and all-time windows with optimized aggregations for fast rendering at scale.

More projects

Get in touch

Working end to end across design, creative, and engineering, where creativity, collaboration, and ownership build toward the company's goals.

jeffkliu@gmail.com