anthropic_sdk_dart
11.0.0, released 9 days ago by davidmiguel.com
Dart client for the Anthropic API with streaming and tool support
What it does
Provides type-safe access to Claude models, supporting messaging, streaming, tool calling, batch processing, and multimodal prompts. It works across Dart and Flutter platforms.
AI-written summary of version 11.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to integrate Claude AI models into your Dart or Flutter application.
- You require advanced Anthropic features like streaming, tool use, and workload identity federation.
Skip it when
- You are using a different LLM provider like OpenAI or Google Gemini and want a generic wrapper.
- You only need a simple server-side implementation and prefer making raw HTTP requests.
Strengths
- Pure Dart client supporting multiple platforms including mobile, web, and server-side.
- Type-safe models mirroring the official Anthropic API specification closely.
Weaknesses
- Tied exclusively to the Anthropic API ecosystem.
- API updates or breaking changes from Anthropic require SDK version updates.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Requires an Anthropic API key or OAuth access token, configured via environment variables or an explicit auth provider.
import 'package:anthropic_sdk_dart/anthropic_sdk_dart.dart';
Future<void> main() async {
final client = AnthropicClient.fromEnvironment();
try {
final response = await client.messages.create(
MessageCreateRequest(
model: 'claude-sonnet-5-5',
maxTokens: 1024,
messages: [InputMessage.user('What is the capital of France?')],
),
);
print(response.text);
} finally {
client.close();
}
}Alternatives
Packages that do the same job and could replace anthropic_sdk_dart.
- firebase_ai
If you are already integrated with Firebase and want to access generative AI models through its ecosystem.
86Compare
Works with
Packages commonly used together with anthropic_sdk_dart: ones it builds on, ones built on it, and its own family.
- cryptoanthropic_sdk_dart depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- logginganthropic_sdk_dart depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- dartantic_aiBuilt on anthropic_sdk_dartAgent framework for building client and server-side apps in Dart with generative AI.