AnthropicChatModel

constructor(client: HttpClient, apiKey: String, model: String, maxTokens: Int = DEFAULT_MAX_TOKENS, parameters: JsonObject = JsonObject(emptyMap()), headers: Map<String, String> = emptyMap(), baseUrl: String = "https://api.anthropic.com", timeout: Duration? = 5.minutes)

Parameters

client

the Ktor client that sends the requests.

apiKey

the Anthropic API key.

model

the id of the model, for example claude-opus-5-5.

maxTokens

the most tokens the model may write in one answer. An answer that reaches the limit comes back with ChatMessage.Assistant.truncated set.

parameters

more fields for the body of every request, such as temperature, thinking or tool_choice. A field given here replaces the one this class would send.

headers

more headers for every request, such as anthropic-beta.

baseUrl

where the API lives. Change it to go through a proxy or a gateway.

timeout

how long one call may take, from the request to the end of the answer, and how long it may wait for the next piece of the answer. It replaces the limits of client and of its engine for the requests of this model. null leaves those limits in place.