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

# Azure OpenAI

> Integrate Azure OpenAI models through the Adaline Proxy for automatic telemetry and observability.

# Azure OpenAI

Integrate Azure-hosted OpenAI models through the Adaline Proxy to automatically capture telemetry — requests, responses, token usage, latency, and costs — with minimal code changes.

## Supported Models

Azure OpenAI supports any OpenAI model deployed in your Azure resource.

**Chat Models**

| Model           | Description                        |
| --------------- | ---------------------------------- |
| `gpt-4o`        | Multimodal with vision support     |
| `gpt-4o-mini`   | Fast and cost-effective multimodal |
| `gpt-4-turbo`   | High capability with 128k context  |
| `gpt-4`         | Original GPT-4 model               |
| `gpt-3.5-turbo` | Fast and cost-effective            |

**Embedding Models**

| Model                    | Description                |
| ------------------------ | -------------------------- |
| `text-embedding-3-large` | Highest quality embeddings |
| `text-embedding-3-small` | Balanced quality and cost  |
| `text-embedding-ada-002` | Legacy embedding model     |

<Note>
  Models must be deployed in your Azure OpenAI resource before use. The model name corresponds to your Azure deployment name.
</Note>

## Proxy Base URL

```
https://gateway.adaline.ai/v1/azure/
```

## Prerequisites

1. An [Azure OpenAI resource](https://portal.azure.com) with deployed models
2. Your Azure OpenAI API key, resource name, and deployment name
3. An [Adaline API key](/docs/admin/create-api-keys), project ID, and prompt ID

## Chat Completions

### Complete Chat

<CodeGroup>
  ```python Python theme={null}
  from openai import AzureOpenAI

  client = AzureOpenAI(
      api_key="your-azure-openai-api-key",
      api_version="2024-02-01",
      azure_endpoint="https://gateway.adaline.ai/v1/azure/",
      azure_deployment="your-deployment-name"
  )

  headers = {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
      "adaline-azure-resource-name": "your-resource-name"
  }

  response = client.chat.completions.create(
      model="gpt-4",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "What is cloud computing?"}
      ],
      extra_headers=headers
  )

  print(response.choices[0].message.content)
  ```

  ```typescript TypeScript theme={null}
  import { AzureOpenAI } from "openai";

  const client = new AzureOpenAI({
    apiKey: "your-azure-openai-api-key",
    apiVersion: "2024-02-01",
    endpoint: "https://gateway.adaline.ai/v1/azure/",
    deployment: "your-deployment-name",
  });

  const response = await client.chat.completions.create(
    {
      model: "gpt-4",
      messages: [
        { role: "system", content: "You are a helpful assistant." },
        { role: "user", content: "What is cloud computing?" },
      ],
    },
    {
      headers: {
        "adaline-api-key": "your-adaline-api-key",
        "adaline-project-id": "your-project-id",
        "adaline-prompt-id": "your-prompt-id",
        "adaline-azure-resource-name": "your-resource-name",
      },
    }
  );

  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

<Warning>
  The `adaline-azure-resource-name` header is **required** for Azure OpenAI. This is the name of your Azure OpenAI resource (not the deployment name).
</Warning>

### Stream Chat

<CodeGroup>
  ```python Python theme={null}
  from openai import AzureOpenAI

  client = AzureOpenAI(
      api_key="your-azure-openai-api-key",
      api_version="2024-02-01",
      azure_endpoint="https://gateway.adaline.ai/v1/azure/",
      azure_deployment="your-deployment-name"
  )

  headers = {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
      "adaline-azure-resource-name": "your-resource-name"
  }

  stream = client.chat.completions.create(
      model="gpt-4",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain Azure services in detail."}
      ],
      stream=True,
      extra_headers=headers
  )

  for chunk in stream:
      if chunk.choices[0].delta.content is not None:
          print(chunk.choices[0].delta.content, end="")
  ```
</CodeGroup>

## Embeddings

<CodeGroup>
  ```python Python theme={null}
  from openai import AzureOpenAI

  client = AzureOpenAI(
      api_key="your-azure-openai-api-key",
      api_version="2024-02-01",
      azure_endpoint="https://gateway.adaline.ai/v1/azure/",
      azure_deployment="your-embedding-deployment-name"
  )

  headers = {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
      "adaline-azure-resource-name": "your-resource-name"
  }

  response = client.embeddings.create(
      model="text-embedding-ada-002",
      input="The quick brown fox jumps over the lazy dog",
      extra_headers=headers
  )

  embedding = response.data[0].embedding
  print(f"Embedding dimension: {len(embedding)}")
  ```
</CodeGroup>

## Next Steps

* [Multi-Step Workflows](/docs/integrations/examples/multi-step-workflows) — RAG pipelines, multi-step generation, and conversational agents
* [Headers Reference](/docs/reference/proxy/headers) — Complete header documentation

***

<Card title="Back to Integrations" icon="arrow-left" href="/docs/integrations/introduction">
  Browse all integrations
</Card>
