
Anthropic Ruby SDK
https://github.com/anthropics/anthropic-sdk-ruby- Category
- Developer Tools
- Rank
- No. 385Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- anthropics
- GitHub
- 366 stars
- Latest release
- v1.69.0
- Date
About
Official Ruby SDK for the Anthropic Claude API.
What it does
It gives Ruby applications a structured client for sending Claude requests and receiving modeled responses. It handles authentication, streaming, retries, pagination, file inputs, typed errors, and request middleware around the underlying HTTP exchange.
Why it's ranked here
A strong choice for modern Ruby services that need more than a thin HTTP wrapper. The package combines a small starting example with extensive models, provider-specific clients, credential discovery, retry policy, and middleware that can inspect unsuccessful responses before typed errors are raised.
What's good
Authentication supports API keys, bearer tokens, profiles, federation, and custom credential providers with cached refresh. Errors distinguish connection, timeout, authentication, permission, rate-limit, and server failures. Middleware receives immutable request data, shared retry metadata, and controlled access to streamed or buffered response bodies.
Tradeoffs
Ruby 3.2 or newer is mandatory. The default request timeout is ten minutes, and potentially longer non-streaming operations are rejected in favor of streaming. Cloud-provider, event-stream, and MCP support depend on optional packages, so those workflows require additional dependency choices.
How to use it well
Use it in Ruby services that call Claude directly and benefit from typed models, streaming, retries, or custom request middleware. Choose one credential strategy explicitly, and stream long generations. It is a client library for application code, not a ready-made chat interface or end-user product.
Technical notes+
README.md documents Bundler installation and Ruby 3.2.0+. lib/anthropic/client.rb defines Anthropic::Client with messages, models, completions, and beta resources; two default retries; exponential backoff with jitter; a 600-second timeout; environment, profile, federation, and callable-provider credential resolution; and token-cache invalidation after authenticated 401 responses. lib/anthropic/errors.rb maps common HTTP statuses to dedicated APIStatusError subclasses. lib/anthropic/middleware.rb exposes frozen APIRequest objects, mutable cross-retry metadata, APIResponse buffering and parsing, retry inspection, and stream body wrapping. lib/anthropic.rb loads AWS, Bedrock, Bedrock Mantle, Vertex, Google Cloud, schema, streaming, pagination, credential, and model components. Gemfile places aws-sdk-bedrockruntime, event_stream_parser, faraday, googleauth, and mcp in an optional dependency group.
Observed
- License
- MIT License
- Primary language
- Ruby
- Packaging
- Distributed as the anthropic gem through RubyGems and installable with Bundler
- Interface
- Ruby client library for the Claude HTTP API
- Runtime support
- Requires Ruby 3.2.0 or newer
- Cloud integrations
- Includes client surfaces for AWS, Bedrock, Bedrock Mantle, Vertex, and Google Cloud
- Optional integrations
- Optional dependencies include AWS Bedrock Runtime, event stream parsing, Faraday, Google authentication, and MCP
Read from README.md, Gemfile, lib/anthropic.rb, lib/anthropic/aws.rb, lib/anthropic/mcp.rb, lib/anthropic/client.rb, lib/anthropic/errors.rb, lib/anthropic/models.rb, lib/anthropic/vertex.rb, lib/anthropic/bedrock.rb, lib/anthropic/version.rb, lib/anthropic/internal.rb, lib/anthropic/file_part.rb, lib/anthropic/streaming.rb, lib/anthropic/middleware.rb.
What it can do
Send text prompts to Claude AI model
Text prompt/message → AI-generated text response
Configure API authentication
API key credentials → Authenticated client connection
Manage conversation context
Multiple messages in sequence → Contextual AI responses
Set model parameters
Temperature, max tokens, model version settings → Configured API request parameters
Handle API responses
Claude API HTTP responses → Parsed Ruby objects with message content
Process streaming responses
Real-time API data stream → Incremental text chunks as they arrive
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.