> ## Documentation Index
> Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# Azure OpenAI

> Add an Azure OpenAI resource under Settings, Model Providers and call its deployments through the LangWatch AI Gateway.

## Add the credential

Open **Settings > Model Providers**, click **Add Model Provider** and select **Azure OpenAI**. Give the row a name, pick the organization, team or project it belongs to, and fill in:

| Field | Value |
| - | - |
| `AZURE_OPENAI_API_KEY` | The key of your Azure OpenAI resource. |
| `AZURE_OPENAI_ENDPOINT` | The resource endpoint, for example `https://acme-eu.openai.azure.com`. |
| `AZURE_OPENAI_API_VERSION` | The `api-version` query parameter. Set a version that serves your models, for example `2025-01-01-preview`. With an older version Azure answers `404 Resource not found`. |

Save the row. Every virtual key whose scope can see the row can now dispatch to it, unless the key restricts its providers. See [Virtual keys](https://langwatch.ai/docs/ai-gateway/virtual-keys.md#create-a-virtual-key).

![The Azure OpenAI provider drawer with AZURE\_OPENAI\_API\_KEY, AZURE\_OPENAI\_ENDPOINT, AZURE\_OPENAI\_API\_VERSION 2025-01-01-preview and two custom models](https://mintcdn.com/langwatch/6EHh-4eZyYKZhosJ/images/ai-gateway/model-provider-azure-form.png?fit=max\&auto=format\&n=6EHh-4eZyYKZhosJ\&q=85\&s=67d43aaa37f10030640468224cd3904c)

An Azure OpenAI row with the API version set and two deployment names under Custom Models.

Switch on **Use API Gateway** when your Azure OpenAI traffic goes through Azure API Management. The form then asks for `AZURE_API_GATEWAY_BASE_URL` and an optional `AZURE_API_GATEWAY_VERSION` (default `2024-05-01-preview`) instead of the endpoint.

## Deployments and model names

Azure serves models through deployments that you name yourself. The gateway uses the model id as the deployment name: `azure/gpt-6-luna` calls the deployment named `gpt-6-luna` on the resource.

Add each deployment name under **Custom Models** on the row. A request for a model that is not on the row's list is rejected before it reaches Azure with `400 provider_config_invalid` and the message `This model provider is not configured to serve "gpt-6-luna"`.

To keep application code on generic names when your deployment names differ, map them on the key with `model_aliases`, for example `{"gpt-6-luna": "azure/acme-mini-eu"}`. See [Model aliases](https://langwatch.ai/docs/ai-gateway/model-aliases.md).

## Send a request

```bash theme={null}
curl https://gateway.langwatch.ai/v1/chat/completions \
  -H "Authorization: Bearer $LANGWATCH_VIRTUAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "azure/gpt-6-luna",
    "messages": [{"role": "user", "content": "Say hi in one word"}]
  }'
```

The gateway sends the request to `<endpoint>/openai/deployments/<deployment>/chat/completions?api-version=<version>` with the key in the `api-key` header.

## Endpoints

| Endpoint | Served |
| - | - |
| `POST /v1/chat/completions` | Yes |
| `POST /v1/responses` | Yes |
| `POST /v1/messages` | Yes, translated |
| `POST /v1/embeddings` | Yes |
| `POST /v1/images/generations`, `POST /v1/images/edits` | No. The gateway answers `400 provider_config_invalid` even when the deployment is on the row's Custom Models list |
| `GET /v1/models` | Yes, the names under Custom Models |

## More than one resource

Create one row per Azure resource and give each a **Routing handle**, for example `eu` and `us`. `eu/gpt-6-luna` pins the request to that resource. A routing policy sets the order a key tries them in. See [Routing policies](https://langwatch.ai/docs/ai-gateway/governance/routing-policies.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.