OpenAICompatibleConfig

org.llm4s.llmconnect.config.OpenAICompatibleConfig
See theOpenAICompatibleConfig companion object
final case class OpenAICompatibleConfig(model: String, baseUrl: String, apiKey: Option[String], contextWindow: Int, reserveCompletion: Int, headers: Map[String, String]) extends ProviderConfig

Configuration for the generic openai-compatible provider: any endpoint that speaks the OpenAI /chat/completions API, such as Groq, Together, Fireworks, a vLLM, LM Studio or llama.cpp server, or an internal gateway.

Nothing is known about the model up front, so the context window and completion reserve come from config, defaulting to the conservative OpenAICompatibleConfig.DEFAULT_CONTEXT_WINDOW and OpenAICompatibleConfig.DEFAULT_RESERVE_COMPLETION. Set them to the model's real limits so context compression neither truncates early nor overflows.

Prefer OpenAICompatibleConfig.fromValues, which validates the values, over the primary constructor.

Value parameters

apiKey

sent as Authorization: Bearer <key>; None sends no Authorization header, for servers that need none. Redacted in toString.

baseUrl

API base URL; requests go to <baseUrl>/chat/completions.

contextWindow

the model's total token capacity (prompt + completion).

headers

extra headers sent on every request, e.g. a gateway's own auth header. Values are redacted in toString.

model

model identifier sent in every request.

reserveCompletion

tokens held back from prompt history for the completion.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override 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

Definition Classes
override def providerId: ProviderId

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

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
override def withModel(model: String): OpenAICompatibleConfig

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

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

Attributes

Definition Classes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product