https://github.com/anthropics/anthropic-sdk-java
https://github.com/anthropics/anthropic-sdk-java
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/anthropics/anthropic-sdk-java
- Owner: anthropics
- License: mit
- Created: 2024-11-26T00:12:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-01T23:02:06.000Z (about 1 month ago)
- Last Synced: 2026-04-02T07:37:29.677Z (about 1 month ago)
- Language: Kotlin
- Size: 6.81 MB
- Stars: 273
- Watchers: 8
- Forks: 64
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-java - Anthropic Java API
- awesome-claude - anthropic-sdk-java
README
# Claude SDK for Java
[](https://central.sonatype.com/artifact/com.anthropic/anthropic-java)
The Claude SDK for Java provides access to the [Claude API](https://docs.anthropic.com/en/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
```kotlin
implementation("com.anthropic:anthropic-java:2.22.0")
```
### Maven
```xml
com.anthropic
anthropic-java
2.22.0
```
## Getting started
```java
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.