Skip to content

fix(llm): correct mispriced model cost table#13

Merged
gurdenbatra merged 1 commit into
mainfrom
phase-1-foundations
Jun 12, 2026
Merged

fix(llm): correct mispriced model cost table#13
gurdenbatra merged 1 commit into
mainfrom
phase-1-foundations

Conversation

@gurdenbatra

Copy link
Copy Markdown
Member

Problem

src/lib/llm/usage.ts had wrong per-token costs, so the Settings usage/cost dashboard (which computes cost from this table at read time) was materially off:

  • Haiku 4.5 was priced at Haiku-3 rates25/125 micro-cents per 1k = $0.25/$1.25 per MTok. Actual Haiku 4.5 is $1/$5 per MTok. → extraction/review/process spend understated ~4×.
  • Opus was 1500/7500 (= $15/$75 per MTok). Actual Opus 4.7/4.8 is $5/$25 per MTok. → any Opus use overstated ~3×.
  • Sonnet 4.6 (300/1500 = $3/$15) was already correct.

Fix

Per-1k micro-cents = (USD per MTok) × 100: Haiku 4.5 → 100/500 (+ claude-haiku-4-5 alias), Opus 4.7 → 500/2500, added claude-opus-4-8. Updated unit tests (they pinned the old Haiku numbers) + added an Opus case.

Test plan

  • vitest run src/lib/llm/__tests__/usage.test.ts → 4 pass
  • clean tsc --noEmit → 0 errors

First slice of Phase 1. withAuth() and the structured-outputs migration are coming as separate focused PRs. Generated Supabase types and the migrations-dir reorg are deferred (both need the Supabase CLI/credentials).

usage.ts priced Haiku 4.5 at Haiku-3 rates (25/125 micro-cents/1k =
$0.25/$1.25 per MTok) — actual Haiku 4.5 is $1/$5 per MTok. Opus was at
1500/7500 ($15/$75) — actual Opus 4.7/4.8 is $5/$25. The Settings usage
dashboard computes cost from this table at read time, so it was understating
extraction spend ~4x and overstating any Opus use ~3x.

Corrected to per-MTok×100 micro-cents/1k: Haiku 100/500, Opus 500/2500;
added the claude-haiku-4-5 alias and a claude-opus-4-8 row. Updated tests.
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cof-learning-system Ready Ready Preview, Comment Jun 11, 2026 10:04pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant