Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function formatTokens(n: number): string {
}

function shortModel(m: string): string {
if (m.includes("fable")) return "Fable";
if (m.includes("opus")) return "Opus";
if (m.includes("haiku")) return "Haiku";
if (m.includes("sonnet")) return "Sonnet";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const STATE_FILE = join(PAI_DIR, "PULSE", "Performance", "aggregator-state.json"

// Model pricing per million tokens (as of 2026-04)
const MODEL_PRICING: Record<string, { input: number; output: number; cacheWrite: number; cacheRead: number }> = {
// Fable 5
"claude-fable-5": { input: 10, output: 50, cacheWrite: 12.50, cacheRead: 1.00 },
// Opus 4 / 4.6
"claude-opus-4-20250514": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.50 },
"claude-opus-4-6": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.50 },
Expand All @@ -35,8 +37,10 @@ const MODEL_PRICING: Record<string, { input: number; output: number; cacheWrite:
function getPricing(model: string): { input: number; output: number; cacheWrite: number; cacheRead: number } {
// Exact match
if (MODEL_PRICING[model]) return MODEL_PRICING[model]
// Fuzzy match: opus, sonnet, haiku
// Fuzzy match: fable, opus, sonnet, haiku — transcripts can carry suffixed
// ids (e.g. "claude-fable-5[1m]") that won't exact-match the table
const lower = model.toLowerCase()
if (lower.includes("fable")) return MODEL_PRICING["claude-fable-5"]
if (lower.includes("opus")) return MODEL_PRICING["claude-opus-4-6"]
if (lower.includes("haiku")) return MODEL_PRICING["claude-haiku-4-5-20251001"]
if (lower.includes("sonnet")) return MODEL_PRICING["claude-sonnet-4-6"]
Expand Down