Anthropic::Client
Constants
API_VERSION = "2023-06-01"
DEFAULT_BASE_URL = "https://api.anthropic.com"
DEFAULT_INITIAL_DELAY = 0.5
DEFAULT_MAX_DELAY = 8.0
DEFAULT_MAX_RETRIES = 2
Constructors
new(api_key : String | Nil = nil, base_url : String = DEFAULT_BASE_URL, timeout : Time::Span = 600.seconds, max_retries : Int32 = DEFAULT_MAX_RETRIES, initial_retry_delay : Float64 = DEFAULT_INITIAL_DELAY, max_retry_delay : Float64 = DEFAULT_MAX_DELAY, default_headers : Hash(String, String) = {} of String => String, middleware : Array = [] of Middleware)
SourceInstance methods
beta
Beta namespace for beta features
client.beta.messages.create(
betas: ["structured-outputs-2025-12-15"],
...
)
get(path : String, params : QueryParams | Nil = nil, extra_headers : Hash(String, String) | Nil = nil) : HTTP::Client::Response
SourceGET request returning raw response body (for binary downloads)
models
Sourcepost(path : String, body, extra_headers : Hash(String, String) | Nil = nil) : HTTP::Client::Response
POST with any JSON::Serializable body
post_multipart(path : String, file : IO, filename : String, content_type : String = "application/octet-stream", extra_headers : Hash(String, String) | Nil = nil) : HTTP::Client::Response
POST multipart form data (for file uploads)