Package org.springframework.ai.anthropic
@NullMarked
package org.springframework.ai.anthropic
Spring AI integration with Anthropic's Claude models using the official
Anthropic Java SDK.
This package provides a ChatModel
implementation that enables interaction with Claude models through Anthropic's Messages
API. The integration supports both synchronous and streaming conversations,
tool/function calling, and full observability through Micrometer.
Key Classes:
AnthropicChatModel- Main chat model implementationAnthropicChatOptions- Configuration options for chat requests
Quick Start:
AnthropicChatModel chatModel = new AnthropicChatModel(
AnthropicChatOptions.builder()
.model("claude-sonnet-4-20250514")
.maxTokens(1024)
.build());
ChatResponse response = chatModel.call(new Prompt("Hello, Claude!"));
- Since:
- 2.0.0
- See Also:
-
ClassDescriptionBase class for common Anthropic SDK configuration options, extended by
AnthropicChatOptions.Anthropic cache options for configuring prompt caching behavior with the Anthropic Java SDK.Defines the caching strategy for Anthropic prompt caching.Anthropic cache TTL (time-to-live) options for specifying how long cached prompts remain valid.Builder for creatingAnthropicChatModelinstances.Chat options forAnthropicChatModel.Builder for creatingAnthropicChatOptionsinstances.Builder class for creating citation-enabled documents using the Anthropic Java SDK.Builder class for AnthropicCitationDocument.Document types supported by Anthropic Citations API.Factory class for creating and configuring Anthropic SDK client instances.Enum representing the pre-built Anthropic Skills available for Claude.Container for Claude Skills in a chat completion request.Represents a Claude Skill - either pre-built Anthropic skill or custom skill.Helper utilities for working with Anthropic Claude Skills responses and files.Enum representing the type of a Claude Skill.Resolves cache eligibility for messages based on the providedAnthropicCacheOptions.Represents a citation reference in a Claude response.Types of citation locations based on document format.