Skip to content

basalt / ai/src / AnthropicProvider

Class: AnthropicProvider ​

Defined in: ai/src/provider/anthropic.ts:33

Anthropic Messages API provider — REST directly, no SDK (same approach as the Elasticsearch driver). System messages are hoisted into the top-level system field, as the API requires.

Implements ​

Constructors ​

Constructor ​

> new AnthropicProvider(options): AnthropicProvider

Defined in: ai/src/provider/anthropic.ts:40

Parameters ​

options ​

AnthropicProviderOptions

Returns ​

AnthropicProvider

Properties ​

model ​

> readonly model: string

Defined in: ai/src/provider/anthropic.ts:35

Concrete model id in use, e.g. 'claude-sonnet-5'.

Implementation of ​

AIProvider.model


name ​

> readonly name: "anthropic" = 'anthropic'

Defined in: ai/src/provider/anthropic.ts:34

Stable id, e.g. 'anthropic'.

Implementation of ​

AIProvider.name

Methods ​

generate() ​

> generate(options): Promise<string>

Defined in: ai/src/provider/anthropic.ts:52

One-shot completion — returns the assistant's full text.

Parameters ​

options ​

GenerateOptions

Returns ​

Promise<string>

Implementation of ​

AIProvider.generate


stream() ​

> stream(options): AsyncIterable<string>

Defined in: ai/src/provider/anthropic.ts:89

Streaming completion — yields chunks as they arrive.

Parameters ​

options ​

GenerateOptions

Returns ​

AsyncIterable<string>

Implementation of ​

AIProvider.stream

Released under the MIT License.