AzureProvider

org.llm4s.llmconnect.provider.AzureProvider
@Stable

Registration for Azure OpenAI deployments.

Azure reuses OpenAIClient but not OpenAIConfig: its endpoint is per-deployment and it requires an apiVersion, which AzureConfig carries.

Both are provider-specific keys of the section - endpoint (required) and apiVersion (default org.llm4s.llmconnect.config.AzureConfig.DEFAULT_API_VERSION) - rather than fields of NamedProviderConfig, which they were until #1133; the HOCON is unchanged:

azure-main {
 provider   = "azure"
 model      = "gpt-4o"
 endpoint   = "https://my-resource.openai.azure.com/"
 apiVersion = "2025-01-01-preview"
}

A resource that forbids keys authenticates with Microsoft Entra ID instead (#2274): authentication = "entra-id" takes tokens from Azure's DefaultAzureCredential - a managed identity, workload identity, the Azure CLI's login - through llm4s-azure-identity, which must then be on the classpath. Such a section takes no apiKey, its own or the shared AZURE_OPENAI_API_KEY; clientId picks a user-assigned managed identity:

azure-prod {
 provider       = "azure"
 model          = "gpt-4o"
 endpoint       = "https://my-resource.openai.azure.com"
 authentication = "entra-id"
 clientId       = ${?AZURE_CLIENT_ID}
}

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

Constructs the client for a ProviderConfig this provider produced.

Constructs the client for a ProviderConfig this provider produced.

config is whatever the caller passed, so implementations must check the type rather than cast — ProviderDescriptor.expectConfig does that and produces the standard mismatch error.

Attributes

def buildConfig(providerName: String, section: NamedProviderConfig)(using ContextWindowResolver): Result[ProviderConfig]

Turns a validated config section into the runtime ProviderConfig for this provider.

Turns a validated config section into the runtime ProviderConfig for this provider.

The section has already been checked against configSpec, so required fields are present and section.extras holds exactly the declared provider-specific keys that have a value (defaults applied, deprecated aliases resolved). A Left here means something configSpec cannot express (a malformed value, say).

Value parameters

providerName

the user's instance name (llm4s.providers.<name>), for error messages.

Attributes

Inherited methods

def aliases: Set[String]

Alternative spellings accepted in provider = "...", folded onto id.

Alternative spellings accepted in provider = "...", folded onto id.

For example Gemini accepts "google". Aliases are matched after the same trim/lowercase canonicalisation as id itself.

Attributes

Inherited from:
ProviderDescriptor

What this provider's client implements. Defaults to the full interface.

What this provider's client implements. Defaults to the full interface.

Attributes

Inherited from:
ProviderDescriptor

Live model discovery, when the provider's API offers it.

Live model discovery, when the provider's API offers it.

Attributes

Inherited from:
ProviderDescriptor

Concrete fields

val ApiKeyAuthentication: String

authentication = "api-key": the section's apiKey, or the shared AZURE_OPENAI_API_KEY.

authentication = "api-key": the section's apiKey, or the shared AZURE_OPENAI_API_KEY.

Attributes

val ApiVersionKey: String

The key naming the Azure OpenAI API version.

The key naming the Azure OpenAI API version.

Attributes

val AuthenticationKey: String

The key choosing how a section authenticates: ApiKeyAuthentication (the default) or EntraIdAuthentication.

The key choosing how a section authenticates: ApiKeyAuthentication (the default) or EntraIdAuthentication.

Attributes

val ClientIdKey: String

The client id of the user-assigned managed identity (or workload identity) Entra ID authentication uses.

The client id of the user-assigned managed identity (or workload identity) Entra ID authentication uses.

Attributes

val EndpointKey: String

The key naming the Azure OpenAI deployment endpoint.

The key naming the Azure OpenAI deployment endpoint.

Attributes

val EntraIdAuthentication: String

authentication = "entra-id": Microsoft Entra ID tokens from llm4s-azure-identity, no API key.

authentication = "entra-id": Microsoft Entra ID tokens from llm4s-azure-identity, no API key.

Attributes

The key falls back to llm4s.credentials.azure.apiKey, bound to AZURE_OPENAI_API_KEY; a section with authentication = "entra-id" needs none.

The key falls back to llm4s.credentials.azure.apiKey, bound to AZURE_OPENAI_API_KEY; a section with authentication = "entra-id" needs none.

Attributes

val id: ProviderId

Canonical id, e.g. ProviderId("openai"). Must be unique within a registry.

Canonical id, e.g. ProviderId("openai"). Must be unique within a registry.

Attributes