For many enterprises, the real question is not "does Claude have a Python SDK?" but "can our existing Java services call it without a sidecar?" The answer is yes. Anthropic publishes an official Java SDK under the Maven coordinates com.anthropic:anthropic-java (the project README pins version 2.48.0 as of this writing). It is MIT licensed — friendly to most corporate open-source policies — and requires only Java 8 or newer, which means it runs on the conservative JVM versions still common in large estates.
Step 1: Add the dependency
Add com.anthropic:anthropic-java to your build the way you add any library: a <dependency> entry in your Maven pom.xml, or an implementation line in your Gradle build file, using the group com.anthropic, artifact anthropic-java, and the current version from the project's releases page. Because the exact snippet drifts with each release, copy it from the official repository rather than from a blog post — including this one. The repository is at github.com/anthropics/anthropic-sdk-java and its README always shows the current coordinates.
Step 2: Build the client
The primary entry point is AnthropicOkHttpClient (the SDK ships with an OkHttp-based transport). The recommended construction path reads configuration from the environment:
// Reads ANTHROPIC_API_KEY (or the anthropic.apiKey system property)
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
fromEnv() looks for the ANTHROPIC_API_KEY environment variable, falling back to the anthropic.apiKey JVM system property — both idiomatic ways to keep secrets out of source code. If your configuration framework hands you the key some other way, build explicitly instead with AnthropicOkHttpClient.builder().apiKey(...).build(). Either way you get back an AnthropicClient (from com.anthropic.client), which is the interface the rest of your code should depend on — useful for testing, since you can substitute a mock.
API keys themselves are created in the Claude Console under Settings → API keys. They have no expiry, so treat them as long-lived production secrets: store in a secrets manager, rotate periodically, and revoke on any suspected leak. For workloads running in cloud platforms or CI/CD, Anthropic recommends Workload Identity Federation — short-lived tokens exchanged from your identity provider — over long-lived keys.
Step 3: Make a synchronous request
The Java SDK follows the resource-oriented shape of the other official SDKs: you call client.messages().create(params), passing a MessageCreateParams object that carries the model ID, a max_tokens cap, and the conversation messages. The call blocks until the response arrives and returns the full message object — reply content plus token-usage metadata. In an enterprise service, wrap it the way you would any outbound dependency: a timeout, retry policy for transient failures, and structured logging of the usage numbers for cost attribution later.
For the parameter-builder details — how to construct MessageCreateParams idiomatically, streaming variants, and async usage — the README's examples are the authoritative reference and stay current with each release.
claude-sonnet-5 for balanced work, claude-opus-4-8 for complex enterprise and agentic tasks, claude-haiku-4-5 for high-volume, low-cost calls. Model IDs change format on some third-party platforms — see why model IDs differ across platforms.Java and the third-party platforms
The core anthropic-java package targets Anthropic's first-party API. For Claude Platform on AWS — Anthropic-operated, running inside AWS with IAM-based access control — there is a companion artifact, com.anthropic:anthropic-java-aws, whose client is built with an AWS backend (.backend(AwsBackend.fromEnv())) that handles SigV4 signing and workspace configuration; the platform-specific clients are in beta. For Amazon Bedrock or Google Vertex AI from Java, consult those platforms' own SDK documentation (see the Bedrock Java article and the Vertex Java article) rather than assuming client classes exist in anthropic-java.
Where to go next
Compare your options in the SDK language overview, harden credentials with API key authentication and Workload Identity Federation, then pick your platform door from the platform guide.