Azure OpenAI provider

Related Documentation
Minimum Version
AI Gateway - 2.0
Incompatible with
on-prem
Tags
#ai
Previous Versions of this page

You can proxy requests to Azure OpenAI AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.

Upstream paths

AI Gateway automatically routes requests to the appropriate Azure OpenAI API endpoints. The following table shows the upstream paths used for each capability.

Capability

Path template

Description

Upstream path or API

Generate /chat/completions, /completions, or /responses Text generation for chat completions and responses /openai/deployments/{deployment_name}/chat/completions
Agentic /assistants or /responses Agent and assistant-based interactions /openai/assistants and /openai/v1/responses
Realtime /realtime Bidirectional streaming for real-time applications /openai/realtime
Embeddings /embeddings Vector embeddings from text input /openai/deployments/{deployment_name}/embeddings
Image /images/generations or /images/edits Image generation and editing /openai/images/generations and /openai/images/edits
Audio speech /audio/speech Text-to-speech synthesis /openai/audio/speech
Audio transcription /audio/transcriptions Speech-to-text conversion /openai/audio/transcriptions
Audio translation /audio/translations Audio translation between languages /openai/audio/translations
Video /videos Video generation /openai/v1/video/generations/jobs
Batches /batches Batch processing of requests /openai/batches
Files /files File management and storage /openai/files

Supported capabilities

The following tables show the AI capabilities supported by the Azure OpenAI provider when configuring AI Models.

By default, AI Gateway uses the path templates shown in the tables below (e.g., /chat/completions, /embeddings, etc.). To customize these paths, configure the config.paths field in your AI Model entity. Custom paths take the form {configured_path}/{template_path} — for example, if you set a custom path of /v2, requests to /embeddings would be routed to /v2/embeddings.

Text generation

Support for Azure OpenAI text generation capabilities:

Capability

Streaming

Model example

Path template

Min version

generate Supported gpt-4o /chat/completions, /completions, or /responses 2.0

Embeddings

Support for Azure OpenAI embeddings generation:

Capability

Model example

Path template

Min version

embeddings1 text-embedding-3-small /embeddings 2.0

1 Use text-embedding-3-small or text-embedding-3-large for dynamic dimensions.

Agentic

Support for Azure OpenAI agent and assistant capabilities:

Capability

Model example

Path template

Min version

agentic2 n/a /assistants or /responses 2.0

2 Assistants API requires header OpenAI-Beta: assistants=v2. Responses API requires config.azure_api_version set to "preview".

Audio

Support for Azure OpenAI audio capabilities (speech synthesis, transcription, and translation):

Capability

Model example

Path template

Min version

speech n/a /audio/speech 2.0
transcription n/a /audio/transcriptions 2.0
translation n/a /audio/translations 2.0

For requests with large payloads, consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Supported audio formats, voices, and parameters vary by model. Refer to your provider’s documentation for available options.

Image

Support for Azure OpenAI image generation and editing capabilities:

Capability

Model example

Path template

Min version

image n/a /images/generations or /images/edits 2.0

For requests with large payloads, consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Supported image sizes and formats vary by model. Refer to your provider’s documentation for allowed dimensions and requirements.

Video

Support for Azure OpenAI video generation capabilities:

Capability

Model example

Path template

Min version

video sora-2 /videos 2.0

For requests with large payloads (video generation), consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Realtime

Support for Azure OpenAI’s bidirectional streaming for realtime applications:

Realtime processing uses WebSocket protocol (ws/wss). This protocol is automatically enabled when you configure your AI Model with the realtime capability.

Capability

Model example

Path template

Min version

realtime3 n/a /realtime 2.0

3 For requests to Azure OpenAI realtime API, include the header OpenAI-Beta: realtime=v1.

Batches

Support for Azure OpenAI batch processing capabilities:

Capability

Model example

Path template

Min version

batches n/a /batches 2.0

Batches are configured on a separate AI Model with type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings. Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.

Files

Support for Azure OpenAI file management capabilities:

Capability

Model example

Path template

Min version

files n/a /files 2.0

Batches are configured on a separate AI Model with type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings. Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.## Azure OpenAI base URL

The base URL is https://{azure_instance}.openai.azure.com:443/openai/deployments/{deployment_name}/{capability_path}. The {capability_path} is determined by the AI capability.

AI Gateway uses this URL automatically. You only need to configure a URL if you’re using a self-hosted or Azure OpenAI-compatible endpoint, in which case set the upstream_url option in your AI Model configuration.

Configure Azure OpenAI

To use Azure OpenAI with AI Gateway, configure a new AI Model Provider. You can then access supported AI Models from Azure OpenAI.

Here’s a minimal configuration for chat completions:

Replace kong-az-east with your Azure OpenAI resource instance name (the subdomain in your resource’s endpoint, for example the kong-az-east in https://kong-az-east.openai.azure.com).

Authentication with Azure IAM

You can also use Azure OpenAI with Azure credentials by setting auth to azure and specifying:

  • use_managed_identity: Set to true to use Azure Managed Identity (recommended for deployments in Azure). When true, the system uses the identity of the current Azure resource (VM, container, function app, etc.).
  • client_id (optional): Entra ID (formerly AAD) application client ID. Required if using a user-assigned managed identity or service principal instead of system-assigned managed identity.
  • client_secret (optional): Client secret for the Entra ID application. Required if client_id is set.
  • tenant_id (optional): Azure tenant ID (directory ID). Required if using service principal credentials.

Regardless of the auth type you use, config.instance is always required and must be set to your Azure OpenAI resource instance name.

FAQs

Yes, if AI Gateway is running on Azure, you can configure an AI Model Provider to detect the designated Managed Identity or User-Assigned Identity of that Azure Compute resource and use it for authentication.

In your AI Model Provider configuration, set auth.type to azure, then:

  • Set auth.use_managed_identity to true to use a system-assigned Managed Identity.
  • Set auth.use_managed_identity to true and auth.client_id to the client ID to use a user-assigned identity.

Then reference this AI Model Provider in your AI Model to proxy requests with the appropriate Azure credentials.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!