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

# Azure

Use the best in class GPT models using Azure's OpenAI API.

## Authentication

Set your environment variables.

<CodeGroup>
  ```bash Mac theme={null}
  export AZURE_OPENAI_API_KEY=***
  export AZURE_OPENAI_ENDPOINT=***
  export AZURE_OPENAI_MODEL_NAME=***
  export AZURE_OPENAI_DEPLOYMENT=***
  # Optional:
  # export AZURE_OPENAI_API_VERSION=***
  ```

  ```bash Windows theme={null}
  setx AZURE_OPENAI_API_KEY ***
  setx AZURE_OPENAI_ENDPOINT ***
  setx AZURE_OPENAI_MODEL_NAME ***
  setx AZURE_OPENAI_DEPLOYMENT ***
  # Optional:
  # setx AZURE_OPENAI_API_VERSION ***
  ```
</CodeGroup>

## Example

Use `AzureOpenAIChat` with your `Agent`:

<CodeGroup>
  ```python agent.py theme={null}
  import os
  from typing import Iterator

  from phi.agent import Agent, RunResponse
  from phi.model.azure import AzureOpenAIChat

  azure_model = AzureOpenAIChat(
      id=os.getenv("AZURE_OPENAI_MODEL_NAME"),
      api_key=os.getenv("AZURE_OPENAI_API_KEY"),
      azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
      azure_deployment=os.getenv("AZURE_OPENAI_DEPLOYMENT"),
  )

  agent = Agent(
      model=azure_model,
      markdown=True
  )

  # Get the response in a variable
  # run: RunResponse = agent.run("Share a 2 sentence horror story.")
  # print(run.content)

  # Print the response on the terminal
  agent.print_response("Share a 2 sentence horror story.")
  ```
</CodeGroup>

## Params

<Snippet file="model-azure-params.mdx" />

Azure also supports the params of [OpenAI](/models/openai).
