ProviderConfig

org.llm4s.llmconnect.config.ProviderConfig

Identifies a specific LLM provider, model, and connection details.

Each subtype carries the credentials, endpoint URL, and context-window metadata needed to construct an org.llm4s.llmconnect.LLMClient via org.llm4s.llmconnect.LLMConnect. Instances are normally obtained from org.llm4s.config.Llm4sConfig.defaultProvider or org.llm4s.config.Llm4sConfig.provider, which resolve configured named providers under llm4s.providers.

Prefer each subtype's fromValues factory over its primary constructor: fromValues resolves contextWindow and reserveCompletion automatically from the model name, so you only need to supply credentials and endpoint.

This trait is deliberately '''not''' sealed. In Scala 3 sealed confines subtypes to the same source file, which would keep every provider's config in this one file forever and make a provider supplied by another module impossible. Implementations are therefore expected from outside llm4s-core, and consumers must not assume the set of subtypes is closed: describe a config through providerId, endpointUrl and withModel rather than by pattern-matching on its runtime type.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def contextWindow: Int

Maximum token capacity of the model across both prompt and completion combined.

Maximum token capacity of the model across both prompt and completion combined.

Attributes

def endpointUrl: Option[String]

The endpoint this config will contact, when it is known statically.

The endpoint this config will contact, when it is known statically.

Used by policy checks and diagnostics that need to know where traffic will go without knowing which provider it belongs to. None means the config carries no single URL — not that it makes no network calls.

Attributes

def model: String

Model identifier forwarded verbatim to the provider API (e.g. "gpt-4o", "claude-sonnet-4-5-latest").

Model identifier forwarded verbatim to the provider API (e.g. "gpt-4o", "claude-sonnet-4-5-latest").

Attributes

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Attributes

Tokens reserved for the model's completion response.

Tokens reserved for the model's completion response.

Context-compression logic caps the prompt history at contextWindow - reserveCompletion, ensuring the model always has at least this many tokens available to generate a reply.

Attributes

def withModel(model: String): ProviderConfig

The same provider and credentials, pointed at a different model.

The same provider and credentials, pointed at a different model.

Attributes