diff --git a/src/pricing.ts b/src/pricing.ts index 7369fd1..080b7f5 100644 --- a/src/pricing.ts +++ b/src/pricing.ts @@ -1,6 +1,6 @@ // Claude Price calculation by model -import { ModelPricing } from './types'; +import { ModelPricing } from "./types"; export interface TokenUsage { input_tokens: number; @@ -16,7 +16,7 @@ const MILL = 1_000_000; // https://platform.claude.com/docs/en/about-claude/pricing const MODEL_PRICING: Record = { // Claude Sonnet 4 - 'claude-sonnet-4-20250514': { + "claude-sonnet-4-20250514": { input_cost_per_token: 3 / MILL, // $3.00 / 1M tokens output_cost_per_token: 15 / MILL, // $15.00 / 1M tokens cache_creation_input_token_cost: 3.75 / MILL, // $3.75 / 1M tokens (5min caching) @@ -24,7 +24,7 @@ const MODEL_PRICING: Record = { }, // Claude Opus 4 - 'claude-opus-4-20250514': { + "claude-opus-4-20250514": { input_cost_per_token: 15 / MILL, // $15.00 / 1M tokens output_cost_per_token: 75 / MILL, // $75.00 / 1M tokens cache_creation_input_token_cost: 18.75 / MILL, // $18.75 / 1M tokens (5min caching) @@ -32,7 +32,7 @@ const MODEL_PRICING: Record = { }, // Claude Opus 4.1 (2025-08-05) - 'claude-opus-4-1-20250805': { + "claude-opus-4-1-20250805": { input_cost_per_token: 15 / MILL, // $15.00 / 1M tokens output_cost_per_token: 75 / MILL, // $75.00 / 1M tokens cache_creation_input_token_cost: 18.75 / MILL, // $18.75 / 1M tokens (5min caching) @@ -40,7 +40,7 @@ const MODEL_PRICING: Record = { }, // Claude Opus 4.1 (alias) - 'claude-opus-4-1': { + "claude-opus-4-1": { input_cost_per_token: 15 / MILL, // $15.00 / 1M tokens output_cost_per_token: 75 / MILL, // $75.00 / 1M tokens cache_creation_input_token_cost: 18.75 / MILL, // $18.75 / 1M tokens (5min caching) @@ -48,7 +48,7 @@ const MODEL_PRICING: Record = { }, // Claude Opus 4.5 (2025-11 v01) - 'claude-opus-4-5-20251101': { + "claude-opus-4-5-20251101": { input_cost_per_token: 5 / MILL, // $5.00 / 1M tokens output_cost_per_token: 25 / MILL, // $25.00 / 1M tokens cache_creation_input_token_cost: 6 / MILL, // $6 / 1M tokens (5min caching) @@ -56,15 +56,31 @@ const MODEL_PRICING: Record = { }, // Claude Opus 4.5 (alias) - 'claude-opus-4-5': { + "claude-opus-4-5": { input_cost_per_token: 5 / MILL, // $5.00 / 1M tokens output_cost_per_token: 25 / MILL, // $25.00 / 1M tokens - cache_creation_input_token_cost: 6 / MILL, // $6 / 1M tokens (5min caching) + cache_creation_input_token_cost: 6.25 / MILL, // $6.25 / 1M tokens (5min caching) + cache_read_input_token_cost: 0.5 / MILL, // $0.50 / 1M tokens + }, + + //Claude Opus 4.6 + "claude-opus-4-6": { + input_cost_per_token: 5 / MILL, // $5.00 / 1M tokens + output_cost_per_token: 25 / MILL, // $25.00 / 1M tokens + cache_creation_input_token_cost: 6.25 / MILL, // $6 / 1M tokens (5min caching) + cache_read_input_token_cost: 0.5 / MILL, // $0.50 / 1M tokens + }, + + //Claude Opus 4.7 + "claude-opus-4-7": { + input_cost_per_token: 5 / MILL, // $5.00 / 1M tokens + output_cost_per_token: 25 / MILL, // $25.00 / 1M tokens + cache_creation_input_token_cost: 6.25 / MILL, // $6 / 1M tokens (5min caching) cache_read_input_token_cost: 0.5 / MILL, // $0.50 / 1M tokens }, // Claude Sonnet 3.5 (2024-10-22) - 'claude-3-5-sonnet-20241022': { + "claude-3-5-sonnet-20241022": { input_cost_per_token: 3 / MILL, // $3.00 / 1M tokens output_cost_per_token: 15 / MILL, // $15.00 / 1M tokens cache_creation_input_token_cost: 3.75 / MILL, // $3.75 / 1M tokens (5min caching) @@ -72,7 +88,7 @@ const MODEL_PRICING: Record = { }, // Claude Haiku 3.5 (Not used anymore) - 'claude-3-5-haiku-20241022': { + "claude-3-5-haiku-20241022": { input_cost_per_token: 0.8 / MILL, // $0.8 / 1M tokens output_cost_per_token: 4 / MILL, // $4.00 / 1M tokens cache_creation_input_token_cost: 1.6 / MILL, // $1.6 / 1M tokens @@ -80,7 +96,7 @@ const MODEL_PRICING: Record = { }, // Claude Haiku 4.5 (2025-10 v01) - 'claude-haiku-4-5-20251001': { + "claude-haiku-4-5-20251001": { input_cost_per_token: 1 / MILL, // $1.00 / 1M tokens output_cost_per_token: 5 / MILL, // $5.00 / 1M tokens cache_creation_input_token_cost: 1.25 / MILL, // $1.25 / 1M tokens @@ -114,7 +130,7 @@ export function getModelPricing(modelName: string | undefined): ModelPricing | n // If unknown model, use Sonnet 4 pricing as default console.warn(`Unknown model: ${modelName}, using Sonnet 4 pricing as fallback`); - return MODEL_PRICING['claude-sonnet-4-20250514']; + return MODEL_PRICING["claude-sonnet-4-20250514"]; } /**