AzureConfig

org.llm4s.llmconnect.config.AzureConfig
See theAzureConfig companion object
@Stable
final case class AzureConfig extends ProviderConfig

Configuration for Azure OpenAI deployments.

Although Azure exposes an OpenAI-compatible API, it uses a different URL structure (per-deployment endpoint) and requires an apiVersion query parameter. org.llm4s.llmconnect.LLMConnect constructs an org.llm4s.llmconnect.provider.OpenAIClient internally; this config carries the Azure-specific fields that OpenAIConfig does not have.

Prefer AzureConfig.fromValues, which validates the values and resolves contextWindow and reserveCompletion from the bundled model catalogue. The constructor is private: build one with the companion apply and adjust it with the with* setters. Java and Kotlin, which cannot see Scala default arguments, use AzureConfig.apply(endpoint, apiKey, model) and the setters, so adding a field never breaks them.

Value parameters

apiKey

Azure API key; redacted in toString.

apiKeyProvider

asked for the key on every request instead of sending apiKey, so a rotated key is used without rebuilding the client (#2477): a section's apiKeyFile sets one. Never set together with tokenProvider.

apiVersion

Azure OpenAI API version string, e.g. "2025-01-01-preview".

contextWindow

Model's total token capacity (prompt + completion combined).

endpoint

Azure OpenAI deployment endpoint URL, e.g. "https://my-resource.openai.azure.com/openai/deployments/my-deploy".

model

Deployment name used as the model identifier.

reserveCompletion

Tokens held back from prompt history for the completion.

timeouts

how long a request and a stream may take: the section's timeouts block. An absent value keeps the client's own default (ProviderTimeouts)

tokenProvider

keyless Microsoft Entra ID authentication (#2274): when set, each request carries Authorization: Bearer <token> from it instead of the api-key header, and apiKey is unused (empty). A section with authentication = "entra-id" gets one from llm4s-azure-identity; in code, build one with that module's AzureEntraId, or implement org.llm4s.llmconnect.auth.AccessTokenProvider directly. Use AzureConfig.keyless or withTokenProvider.

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 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
def withApiKey(apiKey: Secret): AzureConfig
override def withApiKeyProvider(provider: ApiKeyProvider): AzureConfig

Sends the key provider holds at each request in the api-key header, instead of apiKey, so a rotated key is used without rebuilding the client (#2477). A config authenticates one way: this clears tokenProvider.

Sends the key provider holds at each request in the api-key header, instead of apiKey, so a rotated key is used without rebuilding the client (#2477). A config authenticates one way: this clears tokenProvider.

Attributes

Definition Classes

Some as withApiKeyProvider; None goes back to apiKey.

Some as withApiKeyProvider; None goes back to apiKey.

Attributes

def withApiVersion(apiVersion: String): AzureConfig
def withContextWindow(contextWindow: Int): AzureConfig
def withEndpoint(endpoint: String): AzureConfig
override def withModel(model: String): AzureConfig

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

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

Attributes

Definition Classes
override def withNetwork(network: HttpNetworkSettings): AzureConfig

The same config with the given proxy and TLS settings.

The same config with the given proxy and TLS settings.

The loader calls this on every config a descriptor builds, as it does withTimeouts, so a descriptor does not read the http block itself. The default returns this: a config that does not carry the setting ignores it. A config that does overrides this with its own return type.

Attributes

Definition Classes
def withReserveCompletion(reserveCompletion: Int): AzureConfig
override def withTimeouts(timeouts: ProviderTimeouts): AzureConfig

The same config with the given timeouts.

The same config with the given timeouts.

The loader calls this on every config a descriptor builds, passing the section's timeouts block, so a descriptor does not read the block itself. The default returns this: a config that does not carry timeouts, such as one supplied by another module, ignores them. A config that does overrides this with its own return type.

Attributes

Definition Classes

Authenticates with Microsoft Entra ID tokens from tokenProvider instead of the API key, which is cleared.

Authenticates with Microsoft Entra ID tokens from tokenProvider instead of the API key, which is cleared.

Attributes

def withTokenProvider(tokenProvider: Option[AccessTokenProvider]): AzureConfig

Some as withTokenProvider; None goes back to the API key.

Some as withTokenProvider; None goes back to the API key.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

override val 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