RepoAnthropicAnthropicpublished Nov 26, 2024seen 6d

anthropics/anthropic-sdk-java

Kotlin

Open original ↗

Captured source

source ↗
published Nov 26, 2024seen 6dcaptured 13hhttp 200method plain

anthropics/anthropic-sdk-java

Language: Kotlin

License: MIT

Stars: 326

Forks: 87

Open issues: 12

Created: 2024-11-26T00:12:20Z

Pushed: 2026-06-10T00:38:14Z

Default branch: main

Fork: no

Archived: no

README:

Claude SDK for Java

The Claude SDK for Java provides access to the Claude API from Java applications.

Documentation

Full documentation is available at [platform.claude.com/docs/en/api/sdks/java](https://platform.claude.com/docs/en/api/sdks/java).

Installation

Gradle

implementation("com.anthropic:anthropic-java:2.40.1")

Maven

com.anthropic
anthropic-java
2.40.1

Getting started

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.Message;
import com.anthropic.models.messages.MessageCreateParams;
import com.anthropic.models.messages.Model;

// Configures using the `ANTHROPIC_API_KEY` environment variable
AnthropicClient client = AnthropicOkHttpClient.fromEnv();

MessageCreateParams params = MessageCreateParams.builder()
.maxTokens(1024L)
.addUserMessage("Hello, Claude")
.model(Model.CLAUDE_OPUS_4_6)
.build();
Message message = client.messages().create(params);

Requirements

Java 8+

Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md).

License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Notability

notability 5.0/10

Official Anthropic Java SDK launch with moderate stars