Anthropic::Client
Constructors
Class methods
Extract request ID from a response header. Checks both "request-id" (preferred) and "x-request-id" headers.
Instance methods
Access beta-only features through an opt-in namespace.
Creates a Beta::API wrapper that automatically injects beta headers into requests. Pass specific beta headers to include them in all requests made through the beta namespace.
Example:
client.beta.skills.list
client.beta(["some-beta-feature"]).options
Access the legacy completions API.
DEPRECATED: Use #messages instead. The /v1/complete endpoint
is deprecated and provided for backward compatibility only.
Synchronous DELETE with retry
Synchronous GET with retry
Streaming GET — yields response with body_io for streaming responses.
NOTE: Streaming requests do NOT retry because streams cannot be safely replayed. Once the stream starts, there's no way to resume from a partial position. If a transport error occurs mid-stream, the caller must handle retry logic at the application level (e.g., re-initiate the request).
Synchronous POST with retry
Streaming POST — yields response with body_io for SSE.
NOTE: Streaming requests do NOT retry because SSE streams cannot be safely replayed. Once the stream starts, there's no way to resume from a partial position. If a transport error occurs mid-stream, the caller must handle retry logic at the application level (e.g., re-initiate the request).