diff --git a/.changeset/anthropic-sonnet-5-5.md b/.changeset/anthropic-sonnet-5-5.md new file mode 100644 index 0000000000..e4a57a78ea --- /dev/null +++ b/.changeset/anthropic-sonnet-5-5.md @@ -0,0 +1,6 @@ +--- +'@hyperdx/api': patch +'@hyperdx/app': patch +--- + +Use Claude Sonnet 5.5 by default for the Anthropic assistant and include its rates in LLM cost estimates. diff --git a/packages/api/src/controllers/__tests__/ai.test.ts b/packages/api/src/controllers/__tests__/ai.test.ts index b8f985de06..9196d88501 100644 --- a/packages/api/src/controllers/__tests__/ai.test.ts +++ b/packages/api/src/controllers/__tests__/ai.test.ts @@ -2,7 +2,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import type { LanguageModel } from 'ai'; const mockAnthropicModel: LanguageModel = fromPartial({ - modelId: 'claude-sonnet-4-5-20250929', + modelId: 'claude-sonnet-5-5', }); const mockOpenAIModel: LanguageModel = fromPartial({ @@ -151,9 +151,7 @@ describe('anthropic provider', () => { AI_API_KEY: 'sk-test', }); getAIModel(); - expect(mockAnthropicFactory).toHaveBeenCalledWith( - 'claude-sonnet-4-5-20250929', - ); + expect(mockAnthropicFactory).toHaveBeenCalledWith('claude-sonnet-5-5'); }); it('uses custom model name when AI_MODEL_NAME is set', () => { diff --git a/packages/api/src/controllers/ai.ts b/packages/api/src/controllers/ai.ts index e43ebba3c4..baebc7d84d 100644 --- a/packages/api/src/controllers/ai.ts +++ b/packages/api/src/controllers/ai.ts @@ -314,7 +314,7 @@ function getAnthropicModel(): LanguageModel { const anthropic = createAnthropic(anthropicConfig); // Use custom model name if configured, otherwise use default - const modelName = config.AI_MODEL_NAME || 'claude-sonnet-4-5-20250929'; + const modelName = config.AI_MODEL_NAME || 'claude-sonnet-5-5'; return anthropic(modelName); } diff --git a/packages/app/src/llm/__tests__/cost.test.ts b/packages/app/src/llm/__tests__/cost.test.ts index ebeff3487f..0f4dcec12d 100644 --- a/packages/app/src/llm/__tests__/cost.test.ts +++ b/packages/app/src/llm/__tests__/cost.test.ts @@ -41,6 +41,13 @@ describe('MODEL_PRICES catalog', () => { ); }); + it('uses Anthropic rates for Claude Sonnet 5.5', () => { + expect(findModelPrice('claude-sonnet-5-5')).toMatchObject({ + inputPricePerToken: 2e-6, + outputPricePerToken: 10e-6, + }); + }); + it('matches the expanded provider families across id flavors', () => { // xAI (bare + OpenRouter-style ids) expect(findModelPrice('grok-4')?.name).toBe('grok-4'); diff --git a/packages/app/src/llm/lib/modelPrices.ts b/packages/app/src/llm/lib/modelPrices.ts index 45eceb4869..62d47c8bf7 100644 --- a/packages/app/src/llm/lib/modelPrices.ts +++ b/packages/app/src/llm/lib/modelPrices.ts @@ -58,6 +58,8 @@ const AV = '(\\[[^\\]]+\\])?(-v\\d+(:\\d+)?)?(@\\d+)?$'; // Anthropic bills prompt-cache writes at 1.25x the input rate (5m TTL). // prettier-ignore const ANTHROPIC: PriceTuple[] = [ + // https://platform.claude.com/docs/en/about-claude/pricing + ['claude-sonnet-5-5', `${A}claude-sonnet-5-5${AV}`, 2e-6, 10e-6, 2e-7, 2.5e-6], ['claude-opus-5', `${A}claude-opus-5${AV}`, 5e-6, 25e-6, 5e-7, 6.25e-6], ['claude-sonnet-5', `${A}claude-sonnet-5${AV}`, 2e-6, 10e-6, 2e-7, 2.5e-6], ['claude-fable-5', `${A}claude-fable-5${AV}`, 10e-6, 50e-6, 1e-6, 12.5e-6],