ClaudeProvider class

Anthropic Claude provider implementation.

Supports Claude Sonnet 4, Claude Haiku, and other Anthropic models.

final claude = ClaudeProvider(
  config: AIConfig(
    apiKey: 'sk-ant-...',
    model: 'claude-sonnet-4-20250514',
  ),
);

Constructors

ClaudeProvider({required AIConfig config, String apiVersion = '2023-06-01', Client? httpClient})

Properties

apiVersion String
Anthropic API version.
final
capabilities List<AICapability>
List of capabilities this provider supports.
no setter
config → AIConfig
The configuration for this provider.
final
hashCode int
The hash code for this object.
no setterinherited
model String
The current model being used.
no setter
name String
Human-readable name of this provider.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

complete(List<AIMessage> messages, {int? maxTokens, double? temperature, List<AITool>? tools}) Future<AIResponse>
Sends a completion request and returns the full response.
completeStream(List<AIMessage> messages, {int? maxTokens, double? temperature, List<AITool>? tools}) Stream<AIStreamChunk>
Sends a completion request and returns a stream of chunks.
dispose() Future<void>
Releases any resources held by this provider.
embed(String text) Future<List<double>>
Generates embeddings for the given text.
estimateTokens(String text) int
Estimates the number of tokens in the given text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
supports(AICapability capability) bool
Whether this provider supports a specific capability.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited