Claude

class Claude @JvmOverloads constructor(val name: String, client: AnthropicClient, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null) : Model

A Model backed by Anthropic's Claude models through the official Anthropic Java SDK.

Supports streaming, tool calling, extended thinking, image and PDF input, structured output, and prompt caching. Thinking needs ThinkingConfig.thinkingBudget and ignores thinkingLevel.

Parameters

client

The Anthropic SDK client that sends the requests; the caller owns and closes it.

maxTokens

The default max_tokens (8192), used when the request config sets none.

effort

How much reasoning effort Claude spends on each request; null leaves the model's default. While effort or thinking is on, temperature, topP, and topK are not sent.

Constructors

Link copied to clipboard
constructor(name: String, client: AnthropicClient, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)
constructor(name: String, apiKey: String? = null, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)

Creates a Claude model that calls the Anthropic API directly. The SDK client it creates is closed when the model is garbage collected; pass your own AnthropicClient to close it sooner.

constructor(name: String, vertexCredentials: VertexCredentials, maxTokens: Int = DEFAULT_MAX_TOKENS, effort: OutputConfig.Effort? = null)

Creates a Claude model served through Vertex AI. The SDK client it creates is closed when the model is garbage collected; pass your own AnthropicClient to close it sooner.

Types

Link copied to clipboard
class Builder

Fluent builder for Claude, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val name: String

The Claude model name (e.g. claude-sonnet-4-5).

Functions

Link copied to clipboard
Link copied to clipboard
open override fun generateContent(request: LlmRequest, stream: Boolean): Flow<LlmResponse>