anthropic_sdk_dart
Dart client for the Anthropic API. Provides type-safe access to Claude models with streaming, tool use, and batch processing support.
7.0.0
18K downloads/mo
#180 most downloaded on pub.dev
davidmigloz/ai_clients_dart
What this package is like to depend on
Last release 22 days ago
01 Aug 2026
Release timing varies
gaps range from 9 days to 2 months
Nearly every release is documented
notes for 31 of 31 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
32 releases · first in 2024
25 releases in the last 12 months
see the full history below
Release timeline
32 releases · May 2024 to Aug 2026Releases
latest 32-
7.0.001 Aug 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Adds the beta Dreams API (
client.dreams) for asynchronous memory-consolidation jobs over memory stores and session transcripts, mid-conversation tool changes that add or remove tools between turns viatool_addition/tool_removalblocks while preserving the prompt cache, and astrict/best_effortredemption mode for fallback credit tokens, with the outcome reported on the newUsage.fallbackCreditfield. Breaking:MessageCreateRequest.fallbackCreditTokenchanged fromString?toFallbackCreditTokenParam?to carry the new redemption mode. Also adds managed-agent effort levels,initialEventssession seeding, and new environment/memory-store webhook events, and switches memory store endpoints to theagent-memory-2026-07-22beta header (replacingmanaged-agents-2026-04-01). -
6.0.005 Jul 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Syncs to Anthropic OpenAPI spec
506a5ad7, adding Claude Sonnet 5 (claude-sonnet-5), theweb_search_20260318/web_fetch_20260318built-in tool versions with the newresponseInclusioncontrol, and Managed Agents parity: event-delta streaming, credential injection location for env-var vault credentials, per-session agent overrides, backward session pagination, and 13 new agent/deployment webhook events. Breaking:user_profile_idmoved from the message request body to theanthropic-user-profile-idheader (now auserProfileIdmethod parameter), and two closed-enumStringfields are now typed enums (SpanModelUsage.speed,WebSearchResultError.errorCode). Also fixes twobuildUrledge cases with custom base URLs: a trailing slash no longer produces a double slash in the path (which some gateways 404 on), and query params embedded in the base URL (including repeated keys) are now preserved instead of being dropped or collapsed. -
5.0.021 Jun 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Syncs to the latest Anthropic OpenAPI spec (cross-checked field-for-field against
anthropic-sdk-python). Adds the newcode_execution_20260521code-execution tool version — now the default for both the GABuiltInTool.codeExecution(...)and the betaCodeExecutionTool— plus the fallback refusal trigger (FallbackBlock.trigger, a newFallbackRefusalTriggerthat explains why a model handed over at a fallback hop) and thesession.updatedwebhook event (WebhookSessionUpdatedEventData). The breaking surface is small and won't affect most users:FallbackBlock/FallbackInputBlockare normally consumed viafromJson, so pure-deserialization callers are unaffected; the only behavioral change is the code-execution default version, which you can pin by passingtypeexplicitly. See the Migration Guide for details. -
4.2.016 Jun 2026Release notes
Open source →Adds scheduled deployments for Managed Agents — run an agent session on a cron schedule (or on demand) through the new
client.deploymentsandclient.deploymentRunsbeta resources, with each firing producing a deployment run. Also introduces the beta Fallback API for Messages — supply afallbackschain to automatically re-run a refused request on another model (e.g. Fable 5) or retry manually with a refusal credit token — plus environment-variable vault credentials for Managed Agents. Also fixes a latent runtime crash where passing an untyped empty literal (e.g.UpdateSessionParams(vaultIds: [])) to theUpdate*Paramsfamily threw aTypeError. -
4.1.006 Jun 2026Release notes
Open source →Completes field-level parity for the advisor and computer-use built-in beta tools, whose parameters were previously dropped on the Dart side and silently lost on serialization.
AdvisorToolnow carriesallowedCallers,deferLoading, andstrict;ComputerUseTooladds those plusinputExamples(all versions) andenableZoom(only on thecomputer_20251124tool version). See the Anthropic API release notes for the underlying tool updates. -
4.0.029 May 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Refreshes the package to the latest Anthropic OpenAPI spec for the Claude Opus 4.8 release. Adds mid-conversation system messages — the new
mid_conv_systemcontent block (viaInputContentBlock.midConversationSystem) updates system instructions inside themessagesarray without a separate user turn or disrupting prompt caching — plus the spec's newsystemmessage role (MessageRole.system,InputMessage.system(...)/systemBlocks(...)), anoutputTokensDetailsreasoning-token breakdown onUsage/MessageDeltaUsage, and a nullablestopReasonon advisor results. The breaking surface is very small and won't affect most users: the only breaks are one new variant on the exported sealed unionInputContentBlockand one new value (system) on theMessageRoleenum, which affect only code thatswitches over those types exhaustively without a wildcard orUnknown*/defaultbranch. Pure-deserialization consumers are unaffected. -
3.0.024 May 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Completes the four-part Anthropic spec refresh and layers on several beta capabilities: prompt-cache diagnostics (pass
DiagnosticsParam.previousMessageIdand readMessage.diagnostics?.cacheMissReasonto learn why a cache prefix diverged), full request- and response-side search-result citations for grounding answers in your own RAG content, multiagent orchestration with outcome evaluations and rubrics, Session Threads (CRUD + streaming), inbound webhook event parsing, and MCP-OAuth credential validation. Also tolerates missing/nullsignatureon streamedThinkingBlocks from Anthropic-compatible servers (e.g. MiniMax). Breaking: the surface is small and mostly forward-compatibility hardening — new variants were added to the exported sealed unionsCitation,InputContentBlock,SessionEvent, andEventParams, so only code with exhaustiveswitchstatements that lack a wildcard/Unknown*branch needs updating; additionallyUserProfile.relationshipis now a required constructor parameter. Pure-deserialization consumers are unaffected.- BREAKING FEAT: Cache diagnostics, session & skill updates (#236). (6d1d488f)
- BREAKING FEAT: Request-side search_result blocks & per-citation locations (#235). (1f10a79f)
- BREAKING FEAT: Support search_result_location citations and add Unknown fallback (#233). (68e0f797)
- BREAKING FEAT: Add multiagent orchestration, outcome evaluations & rubrics (#230). (d7ac4376)
- BREAKING FEAT: Spec refresh, relationship + thread IDs (#223). (3c6a4bdc)
- FEAT: Add webhook events & credential validation (#231). (075005a6)
- FEAT: Add Session Threads (CRUD + streaming) (#224). (5367e35b)
- FIX: Tolerate missing/null signature on ThinkingBlock.fromJson (#226). (9e17743a)
- CHORE: Fix use_null_aware_elements lint flagged by Dart 3.12 (#232). (31ac5efc)
-
2.2.002 May 2026Release notes
Open source →Adds the Memory Stores beta API — 14 new endpoints exposed under
client.memoryStoreswith child accessors for memories and memory versions. Memory Stores let you persist named memories that can be mounted into agent sessions, with append-only versioning, content-SHA preconditions, view modes (basic/full), and per-version redaction. Surfaces the full data model (MemoryStore,Memory,MemoryVersion, sealedMemoryListItem/MemoryPrecondition,ManagedAgentActor), three new enums, patch-style update params with null-as-delete metadata semantics, and three memory-specific error classes.SessionResourceis extended with a newmemory_storevariant for mounting stores into agent sessions. -
2.1.016 Apr 2026Release notes
Open source →Adds support for Claude Opus 4.7 and refreshes the package to the latest Anthropic OpenAPI spec. Introduces the User Profiles beta API — 5 endpoints exposed as
client.userProfilesfor registering end-user profiles with metadata, per-feature trust grants, and short-lived enrollment URLs. Also extendsEffortLevelwithxhigh, addsTokenTaskBudgetandOutputConfig.taskBudgetfor client-side compaction budgets, wires optionalencrypted_contentthrough compaction blocks, and addsMessageCreateRequest.userProfileIdfor end-user profile routing. -
2.0.016 Apr 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
Adds the beta advisor tool for pairing a faster executor model with a stronger advisor model in a single request, plus
MCPToolUseBlock/MCPToolResultBlockcontent types for mid-generation MCP tool calls. All examples migrate from deprecatedclaude-sonnet-4-20250514toclaude-sonnet-4-6ahead of the June 15, 2026 end-of-life. Breaking: sixSessionfields moved from nullable to required non-nullable in the constructor — direct instantiation requires updates. -
1.5.009 Apr 2026Release notes
Open source →Adds full support for the Managed Agents API (beta) with 33 endpoints across agents, sessions, vaults, and credentials — including SSE streaming for session events. Also adds structured refusal details (
RefusalStopDetails,RefusalCategory) to messages and deltas whenstopReasonisrefusal, and session-scoped file filtering viaFileScopeandscopeId. -
1.4.202 Apr 2026Release notes
Open source →Adds an
extraoverflow field toInputSchemafor passing additional JSON Schema keywords (likeadditionalProperties: false) that the Anthropic API now requires on object-type tool input schemas. All examples and integration tests have been updated accordingly. -
1.4.129 Mar 2026Release notes
Open source →Adds README Usage sections for models, files, and skills resources, and adds a strict semver bullet to the package README.
-
1.4.027 Mar 2026Release notes
Open source →Aligns with the latest Anthropic OpenAPI spec, adding model capabilities (
ModelCapabilities,CapabilitySupport), thinking display modes (ThinkingDisplayMode), andWebFetchToolv20260309 with cache bypass control. Also standardizes equality helper locations and overhauls documentation with llms.txt ecosystem files. -
1.3.216 Mar 2026Release notes
Open source →Complete
McpToolset.toString()to include all fields (authorizationToken,cacheControl) that were previously missing. -
1.3.112 Mar 2026 -
1.3.010 Mar 2026Release notes
Open source →This release adds inline streaming error detection and top-level cache control support for request parameters.
-
1.2.106 Mar 2026Release notes
Open source →Internal improvements to build tooling and package publishing configuration.
-
1.2.004 Mar 2026Release notes
Open source →Added
baseUrlanddefaultHeadersparameters towithApiKeyconstructors, fixedWebSearchToolResultBlock.fromJsoncrash, and improvedhashCodefor list fields. -
1.1.004 Mar 2026Release notes
Open source →Added
withApiKeyconvenience constructors for simplified client initialization and convenience methods for common API patterns like single-message responses and streaming text. -
1.0.003 Mar 2026Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
TL;DR: Complete reimplementation with a new architecture, minimal dependencies, resource-based API, and improved developer experience. Hand-crafted models (no code generation), interceptor-driven architecture, comprehensive error handling, full Anthropic API coverage, and alignment with the latest Anthropic OpenAPI (2026-02-19).
What's new
- Resource-based API organization:
client.messages— Message creation, streaming, token countingclient.messages.batches— Batch message processingclient.models— Model listing and retrievalclient.files— File upload/managementclient.skills— Custom skills management
- Architecture:
- Interceptor chain (Auth → Logging → Error → Transport with Retry wrapper).
- Authentication: API key or custom via
AuthProviderinterface. - Retry with exponential backoff + jitter (only for idempotent methods on 429, 5xx, timeouts).
- Abortable requests via
abortTriggerparameter. - SSE streaming parser for real-time responses.
- Central
AnthropicConfig(timeouts, retry policy, log level, baseUrl, auth).
- Hand-crafted models:
- No code generation dependencies (no freezed, json_serializable).
- Minimal runtime dependencies (
http,logging,metaonly). - Immutable models with
copyWithusing sentinel pattern. - Full type safety with sealed exception hierarchy.
- Improved DX:
- Simplified message creation (e.g.,
InputMessage.user(),InputMessage.assistant()). - Explicit streaming methods (
createStream()vscreate()). - Response helpers (
.text,.hasToolUse,.toolUseBlocks,.thinkingBlocks). - Rich logging with field redaction for sensitive data.
- Simplified message creation (e.g.,
- Full API coverage:
- Messages with tool calling, vision, documents, and citations.
- Extended thinking with budget control.
- Built-in tools (web search, bash, text editor, computer use, code execution, MCP).
- Message batches with JSONL results streaming.
- Files and Skills APIs (Beta).
Breaking Changes
- Resource-based API: Methods reorganized under strongly-typed resources:
client.createMessage()→client.messages.create()client.createMessageStream()→client.messages.createStream()client.countMessageTokens()→client.messages.countTokens()client.createMessageBatch()→client.messages.batches.create()client.listMessageBatches()→client.messages.batches.list()client.listModels()→client.models.list()client.retrieveModel()→client.models.retrieve()
- Model class renames:
CreateMessageRequest→MessageCreateRequestMessage→InputMessageMessageContent.text()→InputMessage.user()/InputMessage.assistant()Block.text()→TextInputBlockBlock.image()→ImageInputBlockBlock.toolResult()→InputContentBlock.toolResult()Model.model(Models.xxx)→ String model ID (e.g.,'claude-sonnet-4-20250514')
- Configuration: New
AnthropicConfigwithAuthProviderpattern:AnthropicClient(apiKey: 'KEY')→AnthropicClient(config: AnthropicConfig(authProvider: ApiKeyProvider('KEY')))- Or use
AnthropicClient.fromEnvironment()to readANTHROPIC_API_KEY.
- Exceptions: Replaced
AnthropicClientExceptionwith typed hierarchy:ApiException,AuthenticationException,RateLimitException,ValidationException,TimeoutException,AbortedException.
- Streaming: Pattern matching replaces
.map()callbacks:event.map(contentBlockDelta: (e) => ...)→if (event is ContentBlockDeltaEvent) ...
- Enum type changes for better type safety:
Skill.source:String→SkillSourceenum (SkillSource.custom,SkillSource.anthropic)Message.role:String→MessageRoleenum (MessageRole.assistant)SkillsResource.list()sourceparameter:String?→SkillSource?
- Tooling API changes for improved type safety:
toolsparameter:List<Map<String, dynamic>>→List<ToolDefinition>toolChoiceparameter:Map<String, dynamic>→ToolChoice
- Session cleanup:
endSession()→close(). - Dependencies: Removed
freezed,json_serializable; now minimal (http,logging,meta).
See MIGRATION.md for step-by-step examples and mapping tables.
Commits
- BREAKING FEAT: Complete v1.0.0 reimplementation (#5). (a0623960)
- BREAKING FEAT: Add typed ToolDefinition and SkillSource for improved type safety (#19). (48311502)
- FEAT: Add speed controls, new built-in tools, tool governance, and ToolCaller type (#35). (ad3c34c6)
- FEAT: Enhance models with documentation and add examples (#13). (bfd99bc6)
- FIX: Pre-release documentation and test fixes (#42). (2fb37b06)
- REFACTOR: Align client package architecture across SDK packages (#37). (cf741ee1)
- REFACTOR: Align API surface across all SDK packages (#36). (ed969cc7)
- DOCS: Refactors repository URLs to new location. (76835268)
- Resource-based API organization:
-
0.3.120 Dec 2025Release notes
Open source →- FIX: Add signature_delta support to BlockDelta (fixes #811) (#878). (1d281837)
- FIX: Update tool types and fix analyzer warnings (#876). (17613b1e)
- FEAT: Add citations_delta support to BlockDelta (#880). (4da916bf)
- FEAT: Add beta features support (#874). (28e4a23a)
- FEAT: Add schema enhancements (#873). (424d3225)
- FEAT: Add Models API (#872). (7962a867)
- FEAT: Add get message batch results endpoint (#871). (46fb2a5d)
- FEAT: Add delete message batch endpoint (#870). (6611e175)
- FEAT: Add cancel message batch endpoint (#869). (b7aa8602)
- FEAT: Add list message batches endpoint (#868). (745e369d)
- FEAT: Add token counting API (#858). (b0d61c92)
-
0.3.015 Oct 2025Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
-
0.3.0+116 Oct 2025 -
0.2.331 Aug 2025 -
0.2.230 Jul 2025 -
0.2.112 Jun 2025 -
0.2.029 Oct 2024Release notes
Open source →[!CAUTION] This release has breaking changes. See the Migration Guide for upgrade instructions.
- FEAT: Add support for Message Batches (#585). (a41270a0)
- FEAT: Add claude-3-5-sonnet-20241022 to model catalog (#583). (0cc59e13)
- BREAKING FEAT: Add support for prompt caching (#587). (79dabaa5)
- BREAKING FEAT: Add computer use support (#586). (36c4a3e3)
- DOCS: Update anthropic_sdk_dart readme. (78b7bccf)
-
0.2.0+116 Dec 2024 -
0.1.002 Jul 2024 -
0.0.131 May 2024Release notes
Open source → -
0.0.1-dev.123 May 2024 pre-release