---
sidebar_label: Azure OpenAI
---

import CodeBlock from "@theme/CodeBlock";

# Azure ChatOpenAI

You can also use the `ChatOpenAI` class to access OpenAI instances hosted on Azure.

For example, if your Azure instance is hosted under `https://{MY_INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}`, you
could initialize your instance like this:

import AzureOpenAI from "@examples/models/chat/integration_azure_openai.ts";

<CodeBlock language="typescript">{AzureOpenAI}</CodeBlock>

If your instance is hosted under a domain other than the default `openai.azure.com`, you'll need to use the alternate `AZURE_OPENAI_BASE_PATH` environemnt variable.
For example, here's how you would connect to the domain `https://westeurope.api.microsoft.com/openai/deployments/{DEPLOYMENT_NAME}`:

import AzureOpenAIBasePath from "@examples/models/chat/integration_azure_openai_base_path.ts";

<CodeBlock language="typescript">{AzureOpenAIBasePath}</CodeBlock>