AnthropicStreamClient class final
Streams chat completions from the Anthropic Messages API
(https://api.anthropic.com/v1/messages).
Wire format: SSE frames with typed event: fields (message_start,
content_block_start, content_block_delta, content_block_stop,
message_delta, message_stop). Text arrives via text_delta deltas;
tool calls arrive as tool_use blocks with input_json_delta partials.
- Implemented types
Constructors
- AnthropicStreamClient({required String apiKey, String baseUrl = 'https://api.anthropic.com/v1', String version = '2023-06-01', Client? client})
Properties
- apiKey → String
-
Anthropic API key (starts with
sk-ant-).final - baseUrl → String
-
API base URL — override for proxies or gateways.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- version → String
-
Anthropic API version header.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
streamChat(
List< AiChatMessage> messages, {required String model, double? temperature, int? maxTokens, Map<String, Object?> extraBody = const {}}) → Stream<Object> -
Streams a chat completion as a sequence of typed events.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited