Skip to content

chore(core): upgrade to @anthropic-ai/sdk 1.x and stop sending temperature to Claude - #357

Merged
anurag629 merged 2 commits into
devfrom
chore/anthropic-sdk-1
Oct 27, 2026
Merged

anurag629 merged 2 commits into
devfrom
chore/anthropic-sdk-1

Conversation

@anurag629

Copy link
Copy Markdown
Member

Replaces #344. Dependabot's bump didn't update the lockfile, and SDK 1.x doesn't type-check against the Claude provider.

SDK 1.x sends anthropic-version: 2026-10-21 instead of 2023-06-01, which isn't only a types change. Per Anthropic's version notes and migration guide, on the Messages API:

  • temperature, top_p and top_k are removed, and sending any of them is a 400 on every model. This one affects us.
  • A document block directly in an assistant message is a 400. We never send one.
  • Citations on text blocks in a user message are a 400. We never send citations in history; history goes back as text, thinking, tool use and tool results only.

Changes

  • @anthropic-ai/sdk ^0.135.0 to ^1.2.0, with the lockfile.
  • temperature is never sent to Claude. A configured value logs one warning and is left out. Before, it was only left out for models that already rejected it (Claude 4.7+, 5.x, Fable, Mythos), including our default claude-haiku-5-5, so for most setups nothing changes. On Claude 4.6 and older, a lowered temperature no longer has an effect. The guide says no setting replaces it, and the warning points to effort. The changeset and the provider docs say this.
  • MessageParam is now a union that includes a system role. The message builder types its roles as 'user' | 'assistant', which is what it always produced.
  • claudeRejectsTemperature stays exported but unused by the provider, with a comment, so nothing that imports it breaks.

Live check

I re-recorded every Claude fixture against the real API with the new SDK (scripts/record-fixtures.mjs claude, a few cents):

  • text
  • max_tokens stop
  • one tool, and parallel tools
  • thinking with a tool call, with the signature sent back on the second request
  • a prompt cache read: 6,504 cached tokens on the second request

All recorded fine. The thinking case needed one retry: with effort: "high" the model decides whether to think, and once it didn't. All tests pass on the new recordings, and no key appears in them.

Checks: build, typecheck, lint (41, same as dev), publint, coverage (1,250 tests), the docs check and the website build.

@anurag629
anurag629 merged commit bd6f3c8 into dev Oct 27, 2026
5 checks passed
@anurag629
anurag629 deleted the chore/anthropic-sdk-1 branch October 27, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant