AzureApiKeyProvider class

Provides Azure OpenAI Service authentication.

Uses the api-key header format required by Azure OpenAI.

Example

final auth = AzureApiKeyProvider('your-azure-api-key');
final client = OpenAIClient(
  config: OpenAIConfig(
    authProvider: auth,
    baseUrl: 'https://your-resource.openai.azure.com',
  ),
);
Implemented types

Constructors

AzureApiKeyProvider(String apiKey)
Creates an AzureApiKeyProvider with the given API key.
const
AzureApiKeyProvider.fromEnvironment([String envVar = 'AZURE_OPENAI_API_KEY'])
Creates an AzureApiKeyProvider from the AZURE_OPENAI_API_KEY environment variable.
factory

Properties

apiKey String
The Azure OpenAI API key.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getHeaders() Map<String, String>
Returns a map of HTTP headers to be included with each request.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited