feat(cli): update @anthropic-ai/sdk to 0.92.0 with prompt caching#245
Open
feat(cli): update @anthropic-ai/sdk to 0.92.0 with prompt caching#245
Conversation
- Bump @anthropic-ai/sdk 0.32.1 -> 0.92.0 (60 releases of improvements)
- Update DEFAULT_MODEL to claude-sonnet-4-6 (latest Sonnet)
- Add prompt caching: system prompts now use cache_control: ephemeral,
cutting input token costs ~90% on repeated pipeline calls that share
the same large system instructions
- Replace string-matching retry logic with typed SDK error classes
(Anthropic.RateLimitError, Anthropic.InternalServerError) for more
accurate retry decisions
- Switch streamClaude to the idiomatic .on('text') + finalMessage()
pattern instead of manual event iteration
All 252 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Updates the Anthropic SDK from
0.32.1to0.92.0(60 releases) and adds prompt caching to cut costs on repeated pipeline runs.Changes in
CLI/src/core/anthropic.tsPrompt caching — the biggest functional improvement. AppFactory runs multi-stage pipelines where large system prompts are sent to Claude on every stage call. By marking system prompts with
cache_control: { type: "ephemeral" }, the Anthropic API caches the tokenised system prompt for 5 minutes and applies a ~90% discount on cached input tokens.Updated default model —
claude-sonnet-4-20250514→claude-sonnet-4-6(latest Sonnet generation).Typed error handling — replaced fragile string-matching retry logic (
msg.includes('rate')) with proper SDK error classes:Idiomatic streaming —
streamClaudenow uses.on('text', ...)+finalMessage()instead of manually iterating raw SSE events.Why
@anthropic-ai/sdk 0.32.1is ~60 minor versions behind the current0.92.0, missing improvements to types, error handling, and streaming helpersTested
tsc --noEmit)npm run test)