← 开源
Kotlin
增长势头
+024 小时新增 Star0.0%
396
Star
108
Fork
35
贡献者
创建于 2024-11-26 · 更新于 2026-12-04 · 今日第 26375 名
主要开发者
README

Anthropic SDK for Java

The Anthropic 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.

Installation

Gradle

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

Maven

<dependency>
  <groupId>com.anthropic</groupId>
  <artifactId>anthropic-java</artifactId>
  <version>3.17.0</version>
</dependency>

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_5_5)
    .build();
Message message = client.messages().create(params);

Requirements

Java 8+

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Versions released before the change from the MIT License, and third-party contributions merged before it, remain under the MIT License. See LICENSE-MIT.

排名相邻

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载