Project 03 · SQL Portfolio · Julieth Ramos Rivera
Luminary AI
AI Infrastructure COGS Analysis · July 2024
Business Question: What does it cost to serve each customer — and where is the margin? 20 customers 3 pricing tiers 3 months of data MySQL Workbench
Blended Gross Margin
0%
Platform-wide · July 2024
Benchmark: 65–70% for AI SaaS
Total Monthly COGS
$0
Across all 20 customers
GPU compute is ~65% of this
Starter Tier Margin
0%
8 customers · Highest risk
Near breakeven unit economics
Enterprise Tier Margin
0%
5 customers · Platform anchor
Subsidizes blended margin
Mis-tiered Customers
0
Over usage ceiling for their tier
Monthly leakage: ~$96+
GPU Share of COGS
0%
Largest single cost driver
Advanced model inference
Gross Margin % by Tier — July 2024
Challenge 03 output · Margin = (MRR − COGS) / MRR · Dashed line = 65% SaaS benchmark
65% benchmark (SaaS industry standard for AI platforms)
COGS Breakdown by Tier
Challenge 02 output · Each segment shows the cost component driving monthly COGS per tier
Monthly COGS by Tier — SUM() OVER() Window Function Output
Challenge 06 output · Running COGS accumulation per tier · Numbers in USD
Challenge 04 — Customer Tier Fit by Token Usage (July 2024)
CASE WHEN flags mis-tiered customers based on actual token usage vs. tier ceiling.
CompanyCurrent TierMRRTokens (M)Tier CeilingTier FitEst. Leakage/mo
INNER JOIN
Match customers to usage — only paired rows returned
Cost × Rate
Dynamic COGS: usage columns × rate card via arithmetic
Gross Margin %
(MRR − COGS) / MRR — core SaaS unit economics formula
CASE WHEN
Multi-condition classification: tier fit, margin flags
RANK() OVER()
Window function: rank customers globally and by tier
SUM() OVER()
Running cumulative COGS by tier across months
CTE (WITH)
Multi-step logic: pre-calculate COGS before aggregating
// Board-Ready Finding
Starter tier unit economics are broken.
Repricing and overage enforcement are required before next fundraise.
SQL analysis of Luminary AI's July 2024 infrastructure data reveals a blended gross margin of ~55% — below the 65–70% benchmark for AI SaaS. The Starter tier drives this deficit: at $500–600 MRR, GPU compute and overhead consume over 70% of revenue. One Growth customer (Skyline Marketing) is processing 20% above their token ceiling, generating $96/month in unrecovered COGS leakage. Enterprise customers (74% gross margin) are subsidizing platform profitability. The recommended path: reprice Starter to $750+, implement overage billing at $0.008/token above ceiling, and route ≥20% of standard inference calls away from advanced models — targeting a blended margin of 65% within two quarters.
⬆ Reprice Starter Tier to $750+/mo
⚡ Enforce Token Overage Billing
🔁 Route 20% Calls to Standard Model