class

Arcana::AI::Chat::Anthropic

Inherits Arcana::AI::Chat::Provider < Arcana::AI::Traceable < Reference < Object

Constants

API_VERSION = "2023-06-01"
DEFAULT_MODEL = "claude-sonnet-4-20250514"
ENDPOINT = "https://api.anthropic.com/v1/messages"
MAX_TOKENS_DEFAULT = 4096

Constructors

new(api_key : String, model : String = DEFAULT_MODEL, max_tokens : Int32 = MAX_TOKENS_DEFAULT, endpoint : String = ENDPOINT, trace : Proc(String, Nil) | Nil = nil)
Source

Instance methods

complete(request : Request, ctx : Context) : Response

Complete with cancellation support. Override for real mid-flight abort.

Source
complete(request : Request) : Response
Source
model
Source
models

List available models. Override in subclasses that support it.

Source
name
Source
stream(request : Request, ctx : Context | Nil = nil, &block : StreamEvent -> ) : Response

Stream a chat completion, yielding events as they arrive. Override in subclasses that support streaming.

Source