https://github.com/AoElite/claude4j
A very simple java library to interact with Claude's API
https://github.com/AoElite/claude4j
anthropic anthropic-claude claude claude-3 claude-ai claude-api java library
Last synced: 5 months ago
JSON representation
A very simple java library to interact with Claude's API
- Host: GitHub
- URL: https://github.com/AoElite/claude4j
- Owner: AoElite
- License: mit
- Created: 2024-03-20T23:36:04.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-16T05:48:41.000Z (7 months ago)
- Last Synced: 2025-03-16T06:25:16.293Z (7 months ago)
- Topics: anthropic, anthropic-claude, claude, claude-3, claude-ai, claude-api, java, library
- Language: Java
- Homepage:
- Size: 87.9 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!WARNING]
> **This repository is being archived. Please use Anthropic's official Java SDK instead.**
> https://github.com/anthropics/anthropic-sdk-javaA very simple java library to interact with Claude's API
Example usage:
```java
ClaudeAPI client = new ClaudeClient(System.getenv("CLAUDE_API_KEY"));ClaudeResponse response = client.sendRequest(ClaudeRequest.builder()
.model(ClaudeAIModel.HAIKU_3_5)
.max_tokens(100)
.temperature(0)
.stop_sequence("###")
.system("You are a AI math assistant")
.input(ClaudeRole.USER.text("what's 2+2?"))
.input(ClaudeRole.ASSISTANT.text("4"))
.input(ClaudeRole.USER.text("what's 3+3?"))
.build());if (response != null) { // response could timeout
for (String string : response.getContent()) {
System.out.println(string);
}
}
```You can create a API key [here](https://console.anthropic.com/settings/keys) once you have created a Anthropic account.
TODO:
- [X] Image/File support
- [ ] Stream support
- [ ] Embeddings
- [ ] Legacy models
- [ ] Cache support