AnthropicClient class

Native Anthropic Messages API client with streaming support. Direct port of neomage/src/services/api/claude.ts core functionality. Includes retry logic with exponential backoff for transient errors.

Inheritance

Constructors

AnthropicClient(ApiConfig config, {RetryConfig retryConfig = RetryConfig.defaultConfig})
Creates a client with the given Anthropic config.

Properties

config → ApiConfig
final
hashCode → int
The hash code for this object.
no setterinherited
retryConfig → RetryConfig
Retry configuration for transient errors.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createMessage({required List<Message> messages, required String systemPrompt, List<ToolDefinition> tools = const [], int? maxTokens}) → Future<Message>
Send a non-streaming message completion with automatic retry.
override
createMessageStream({required List<Message> messages, required String systemPrompt, List<ToolDefinition> tools = const [], int? maxTokens}) → Stream<StreamEvent>
Stream a message completion via the Anthropic Messages API.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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