Skip to content

fix: default Anthropic assistant to Claude Sonnet 5.5 - #3821

Open
pcbeingused333 wants to merge 2 commits into
ClickHouse:mainfrom
pcbeingused333:ai/anthropic-sonnet-5-5
Open

pcbeingused333 wants to merge 2 commits into
ClickHouse:mainfrom
pcbeingused333:ai/anthropic-sonnet-5-5

Conversation

@pcbeingused333

@pcbeingused333 pcbeingused333 commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

The ClickStack AI assistant defaults to claude-sonnet-4-5-20250929 for Anthropic deployments that leave AI_MODEL_NAME unset. Anthropic retires that model on November 30, 2026 and recommends claude-sonnet-5-5 as the replacement (model deprecations). After that date, the assistant would fail for every deployment relying on the default. This change switches the default to claude-sonnet-5-5; an explicit AI_MODEL_NAME still takes precedence. The installed @ai-sdk/anthropic (4.0.65) already treats claude-sonnet-5* as supporting native structured output, so the existing Output.object call needs no changes.

The new model costs USD 2 / USD 10 per million input / output tokens, down from USD 3 / USD 15 (pricing). The LLM cost catalog had no entry matching claude-sonnet-5-5 (the claude-sonnet-5 pattern does not match the -5 suffix), so spans from the new default would show no cost estimate. This adds the entry with its prompt-cache rates; the historical Sonnet 4.5 rates are kept.

How to reproduce

Starting point: unit tests only; no API key or paid requests needed.

On main (with only this PR's two test-file changes applied):

  1. cd packages/api && yarn jest --runInBand src/controllers/__tests__/ai.test.ts → uses default model when AI_MODEL_NAME is not set fails: expected "claude-sonnet-5-5", received "claude-sonnet-4-5-20250929".
  2. cd packages/app && yarn jest --runInBand src/llm/__tests__/cost.test.ts → uses Anthropic rates for Claude Sonnet 5.5 fails (no catalog match).

On this branch:

  1. Both suites pass (18/18 and 20/20).

How to test on Vercel preview

N/A — non-UI change.

References

  • Related PRs: none

AI assistance was used to prepare this change and its tests.


Note

Low Risk
Small configuration default and pricing-catalog update ahead of model deprecation; custom AI_MODEL_NAME behavior is unchanged.

Overview
Switches the default Anthropic assistant model from the retiring claude-sonnet-4-5-20250929 to claude-sonnet-5-5 when AI_MODEL_NAME is unset; explicit AI_MODEL_NAME still overrides.

Adds a dedicated LLM cost catalog entry for claude-sonnet-5-5 (including prompt-cache rates) so spans from the new default get cost estimates—the existing claude-sonnet-5 pattern did not match the -5-5 id. Unit tests for model selection and pricing are updated accordingly.

Reviewed by Cursor Bugbot for commit 7ee8d53. Bugbot is set up for automated code reviews on this repo. Configure here.

@pcbeingused333
pcbeingused333 requested a review from a team as a code owner November 25, 2026 06:57
@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@pcbeingused333 is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ee8d53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added external needs-vouch Author needs a maintainer to vouch for them labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @pcbeingused333, thanks for the pull request!

Before we review code from a first-time contributor, a maintainer vouches for them, and you're not on our list yet. There's nothing else to file and this PR stays open — a maintainer will look at it, usually within a day or two, and vouch for you right here if it's a genuine attempt at the problem.

To make that quick, check the PR description has:

  • The issue it addresses (ideally one labelled Accepting PR) and why the change is needed
  • Steps to reproduce the problem and verify the fix, starting from https://play.hyperdx.io or yarn app:dev:local connected to the demo server
  • Before/after screenshots if anything in the UI changed

More detail in our contributing guide.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

3 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 2 P3

None could be anchored to changed lines; they are listed below. 2 P3 folded at the bottom.

Findings outside the changed lines

  • 🟡 P2 packages/api/src/controllers/ai.ts:335 — OpenAI/LiteLLM error message still suggests the retiring claude-sonnet-4-5-20250929 as an example model name → Change the example to "claude-sonnet-5-5". Otherwise, after November 30, 2026 this error points users to a model that no longer works, which is the problem this PR fixes for the default.
🔵 2 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/llm/lib/modelPrices.ts:62 — New claude-sonnet-5-5 row copies the prices of the claude-sonnet-5 row, so the same rates now live in two places → Delete the new row and widen the existing pattern to ${A}claude-sonnet-5(-5)?${AV}, the same way claude-opus-4-x and claude-sonnet-4-x cover their minor versions (claude-sonnet-4(-[5-9])?). That keeps one source of truth for Sonnet 5.x rates. If the separate name is wanted for display, add a comment naming the twin row.
  • 🔵 P3 packages/app/src/llm/__tests__/cost.test.ts:44 — Sonnet 5.5 price test checks only the bare id and never the cache rates → Also assert findModelPrice('us.anthropic.claude-sonnet-5-5-v1:0') and findModelPrice('claude-sonnet-5-5@20261101') (Bedrock/Vertex ids), plus the cached-input and cache-write prices. The existing Sonnet 4.5 cases at lines 24-35 already test these id flavors. As written, a wrong cache-write rate or a broken A/AV wrapper on the new pattern would still pass.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

The change is tightly scoped: the default Anthropic model string flips to claude-sonnet-5-5, a matching MODEL_PRICES catalog entry is added, and both branches are covered by updated tests. Catalog ordering is safe — claude-sonnet-5's AV tail cannot consume the trailing -5, so the new and existing entries are mutually exclusive and neither shadows the other regardless of position. An explicit AI_MODEL_NAME still overrides the default.

🟡 P2 — recommended

  • packages/app/src/llm/__tests__/cost.test.ts:45 — the new tuple at modelPrices.ts:62 introduces cache rates (cachedInputPricePerToken 2e-7, cacheWriteInputPricePerToken 2.5e-6), but the added toMatchObject assertion checks only inputPricePerToken/outputPricePerToken, leaving the new cache rates unverified.
    • Fix: Extend the toMatchObject assertion to also assert cachedInputPricePerToken: 2e-7 and cacheWriteInputPricePerToken: 2.5e-6.
    • testing, correctness

Reviewers (5): correctness, testing, maintainability, project-standards, kieran-typescript.

Testing gaps:

  • The new claude-sonnet-5-5 entry is only exercised as a bare id; unlike sibling Claude entries, no Bedrock (us.anthropic.claude-sonnet-5-5-v1:0), Vertex (@date), or bracket ([1m]) variant is asserted to resolve to the new entry (and not the adjacent claude-sonnet-5).
  • No test ties the API default claude-sonnet-5-5 to the existence of a matching catalog entry; the two packages stay in sync only by convention, so a future default change could silently lose cost estimation.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@pulpdrew pulpdrew added automerge and removed needs-vouch Author needs a maintainer to vouch for them labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI review gate — Human approval in place of AI review

Approved on the head commit by pulpdrew (write access, not the author), standing in for the AI review:

  • Cursor Bugbot is still reviewing this commit.

What to do:

  • Nothing to do yet if the review is running. The gate turns green when it finishes clean.
  • No review showing up? Post bugbot run as a new top-level PR comment. If that does nothing, Bugbot is probably not enabled for this repository: ask a repository administrator.

Evaluated at 7ee8d530. This required workflow does not re-run on its own once the AI review later concludes — check the Cursor Bugbot check on this commit directly for its current state.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

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

// 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.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants