Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .changeset/anthropic-sonnet-5-5.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 2 additions & 4 deletions packages/api/src/controllers/__tests__/ai.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/controllers/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions packages/app/src/llm/__tests__/cost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/llm/lib/modelPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong Sonnet 5.5 cache-read rate

Medium Severity

The new claude-sonnet-5-5 catalog entry sets cachedInputPricePerToken to 2e-7 ($0.20/MTok), the Sonnet 5 cache-read rate. Anthropic prices Sonnet 5.5 cache hits at $0.10/MTok (1e-7, 0.05x input). Input, output, and 5-minute cache-write rates match. Spans that use prompt caching therefore overstate cache-read cost by 2x in both the UI estimate and the ClickHouse cost SQL.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7ee8d53. Configure here.

['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],
Expand Down
Loading