AnthropicProvider
Class: AnthropicProvider
Defined in: ai/anthropic.ts:8
AIProvider backed by Anthropic's Claude API. Loads @anthropic-ai/sdk
lazily on the first complete() call so the package does not force the
SDK into consumers' graphs at import time.
Implements
Constructors
Constructor
new AnthropicProvider(
opts?):AnthropicProvider
Defined in: ai/anthropic.ts:14
Parameters
opts?
construction options.
apiKey?
string
Anthropic API key (falls back to ANTHROPIC_API_KEY env).
model?
string
model identifier (defaults to the current Haiku).
Returns
AnthropicProvider
Methods
complete()
complete(
prompt,options?):Promise<string>
Defined in: ai/anthropic.ts:24
Send a single completion request to Claude.
Parameters
prompt
string
the user-side prompt text.
options?
optional tuning parameters.
maxTokens?
number
maximum tokens for the response (default 512).
Returns
Promise<string>
the first text block of the response; empty string if none.