
Anthropic Java SDK
https://github.com/anthropics/anthropic-sdk-java- Category
- Developer Tools
- Rank
- No. 384Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- anthropics
- GitHub
- 366 stars
- Latest release
- v2.61.0
- Date
About
Official Java/Kotlin SDK for the Anthropic Claude API.
What it does
It gives JVM applications a typed client for sending Claude requests and handling responses. Builders assemble request parameters, while synchronous and asynchronous pagers traverse multi-page results. Configuration covers authentication, HTTP behavior, retries, timeouts, logging, interceptors, JSON mapping, and alternate backend adaptation.
Why it's ranked here
This is a strong choice for production JVM integrations because it combines a straightforward request model with practical transport controls. Automatic retries, pagination helpers, configurable validation, and backend adaptation reduce plumbing. The main caution is dependency compatibility, especially around Jackson, plus debug logs that may expose body data.
What's good
The client supports both blocking and asynchronous pagination, including Java streams and completion futures. Interceptors can inspect canonical Anthropic requests and normalized responses, while backend-specific signing and URL changes remain below them. Runtime Jackson checks catch incompatible dependency sets early. Retry behavior explicitly covers connection failures and selected HTTP errors.
Tradeoffs
The SDK requires Java 8 or newer and depends on a compatible Jackson stack, with runtime checks enabled by default. Full response validation is disabled by default because enabling it can break forward compatibility with new API types. Debug logging redacts sensitive headers but may still reveal sensitive request or response bodies. Asynchronous pagers allow only one subscription.
How to use it well
Use it in Java or Kotlin services that need typed Claude requests, controlled retries, custom HTTP interception, or paginated processing. Start with environment-based credentials and the supplied HTTP client, then tune timeouts, logging, and validation deliberately. It is an application library, not a standalone command-line workflow or hosted orchestration layer.
Technical notes+
anthropic-java-core/src/main/kotlin/com/anthropic/core/ClientOptions.kt composes the HTTP stack with interceptors, authorization, logging, retries, timeouts, response validation, a configurable JsonMapper, and owned executors. anthropic-java-core/src/main/kotlin/com/anthropic/core/Check.kt enforces Jackson 2.13.4 minimum compatibility and rejects known-bad 2.18.1. anthropic-java-core/src/main/kotlin/com/anthropic/core/AutoPager.kt exposes Iterable<T> and Stream<T>, while anthropic-java-core/src/main/kotlin/com/anthropic/core/AutoPagerAsync.kt implements a single-subscription state machine over CompletableFuture. anthropic-java-core/src/main/kotlin/com/anthropic/backends/Backend.kt defines request preparation, authorization, response normalization, base URL selection, and resource cleanup hooks.
Observed
- License
- MIT License
- Primary language
- Kotlin source targeting Java applications and JVM interoperability
- Packaging
- Published to Maven Central as com.anthropic:anthropic-java
- Install surface
- Gradle and Maven dependency declarations
- Interface
- Application library providing typed access to the Claude API
- Platform requirement
- Java 8 or newer
- Generated structure
- Core pagination and client configuration files identify OpenAPI generation by Stainless
Read from README.md, anthropic-java-core/src/main/kotlin/com/anthropic/core/Page.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/Check.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/Params.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/LogLevel.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/AutoPager.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/PageAsync.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/Properties.kt, anthropic-java-core/src/main/kotlin/com/anthropic/backends/Backend.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/ClientOptions.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/ObjectMappers.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/AutoPagerAsync.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/BaseSerializer.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/DefaultSleeper.kt, anthropic-java-core/src/main/kotlin/com/anthropic/core/PrepareRequest.kt.
What it can do
Send text prompts to Claude AI models
Text prompts and messages → AI-generated text responses
Create conversational AI chat sessions
Multiple messages in conversation format → Contextual AI responses maintaining conversation history
Configure AI model parameters
Model settings (temperature, max tokens, model version) → Customized AI behavior and response characteristics
Handle streaming AI responses
API requests with streaming enabled → Real-time token-by-token AI response stream
Authenticate API requests
API keys and credentials → Authorized access to Claude API services
Process multi-turn conversations
Series of user and assistant message exchanges → Coherent AI responses aware of full conversation context
Manage API error handling
Failed API requests and error conditions → Structured error responses and exception handling
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.