AnthropicConfig

org.llm4s.llmconnect.config.AnthropicConfig
See theAnthropicConfig companion class

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(apiKey: String, model: String, baseUrl: String, contextWindow: Int, reserveCompletion: Int, workloadIdentity: Option[AnthropicWorkloadIdentity]): AnthropicConfig

Builds a config without validating it; fromValues validates, and AnthropicClient applies validate to whatever it is given. workloadIdentity defaults to None, which authenticates with apiKey.

Builds a config without validating it; fromValues validates, and AnthropicClient applies validate to whatever it is given. workloadIdentity defaults to None, which authenticates with apiKey.

Attributes

def apply(apiKey: String, model: String): AnthropicConfig

The API key and model, every other field at its default: the entry point for Java and Kotlin, which do not see Scala default arguments. The base URL is DEFAULT_BASE_URL, and contextWindow and reserveCompletion come from the model name alone (200k for current Claude models); set them, and the rest, with the with* setters, or use fromValues to consult the bundled model catalogue.

The API key and model, every other field at its default: the entry point for Java and Kotlin, which do not see Scala default arguments. The base URL is DEFAULT_BASE_URL, and contextWindow and reserveCompletion come from the model name alone (200k for current Claude models); set them, and the rest, with the with* setters, or use fromValues to consult the bundled model catalogue.

Attributes

def fromValues(modelName: String, apiKey: String, baseUrl: String, workloadIdentity: Option[AnthropicWorkloadIdentity])(using resolver: ContextWindowResolver): Result[AnthropicConfig]

Constructs an AnthropicConfig, resolving contextWindow and reserveCompletion from the model name automatically.

Constructs an AnthropicConfig, resolving contextWindow and reserveCompletion from the model name automatically.

Value parameters

apiKey

Anthropic API key; must be non-empty.

baseUrl

API base URL; must be non-empty, and https://api.anthropic.com (or http to a loopback host) when workloadIdentity is set.

modelName

Model identifier, e.g. "claude-sonnet-4-5-latest".

workloadIdentity

workload identity federation; apiKey must then be empty.

Attributes

Returns

Left(ConfigurationError) for a blank field or a config validate refuses.

Concrete fields

val DEFAULT_BASE_URL: String

The Anthropic API base URL used when a named provider section sets no baseUrl.

The Anthropic API base URL used when a named provider section sets no baseUrl.

This was DefaultConfig.DEFAULT_ANTHROPIC_BASE_URL in llm4s-core until the provider moved to llm4s-anthropic (#1132).

Attributes