> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatazureopenai.md).

# Microsoft Foundry Chat Model

Learn how to use the Microsoft Foundry Chat Model node in n8n. Follow technical documentation to integrate Microsoft Foundry Chat Model node into your workflows.

The Microsoft Foundry Chat Model node connects conversational agents[^1] to the chat models on your Microsoft Foundry or Azure OpenAI resource.

This node was previously called the **Azure AI Foundry Chat Model** node and the **Azure OpenAI Chat Model** node.

On this page, you'll find the node parameters for the Microsoft Foundry Chat Model node, and links to more resources.

{% hint style="info" %}
**Credentials**

Refer to the [Microsoft Foundry credentials documentation](/integrations/builtin/credentials/azureopenai.md) for authentication information for this node.
{% endhint %}

{% hint style="info" %}
**Parameter resolution in sub-nodes**

Sub-nodes behave differently to other nodes when processing multiple items using an expression.

Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five `name` values, the expression `{{ $json.name }}` resolves to each name in turn.

In sub-nodes, the expression always resolves to the first item. For example, given an input of five `name` values, the expression `{{ $json.name }}` always resolves to the first name.
{% endhint %}

## Node parameters <a href="#node-parameters" id="node-parameters"></a>

* **Authentication**: Choose **API Key** or **Azure Entra ID (OAuth2)**. Each option uses its own credential.
* **Project**: Enter the name of the Microsoft Foundry project that owns the deployment. Leave it empty to use the **Project** from the credential. A classic Azure OpenAI resource doesn't use it.
* **Model (Deployment)**: Select the deployment to use to generate the completion.
  * **From List**: Choose from the deployments in your project. The list shows chat deployments only. It needs a Microsoft Foundry credential and a **Project**, in this field or in the credential. Set **Project** first.
  * **By ID**: Enter the deployment name. Use this for a classic Azure OpenAI credential, or for a deployment that isn't in the list.
* **Model Family**: Choose the API family the deployment uses. Azure doesn't report this, so set it to match your deployment.
  * **OpenAI**: For GPT and other OpenAI-compatible models.
  * **Anthropic**: For Claude models. This needs a credential that uses the Microsoft Foundry endpoint type. The **Frequency Penalty**, **Presence Penalty**, and **Response Format** options aren't available for this family.
* **Use Responses API**: Choose which API the node calls for an OpenAI family deployment. This needs a credential that uses the Microsoft Foundry endpoint type.
  * **Off** (default): The node calls the Chat Completions API. Use this for most deployments.
  * **On**: The node calls the Responses API. Turn this on for a deployment that only supports the Responses API. Azure returns a `400 Model not supported` error if you call such a deployment with Chat Completions.

{% hint style="info" %}
**Existing workflows**

Workflows created before these changes keep the **Model (Deployment) Name** text field and use Chat Completions. Create a new node to use the deployment list and the **Use Responses API** setting.
{% endhint %}

## Node options <a href="#node-options" id="node-options"></a>

* **Frequency Penalty**: Use this option to control the chances of the model repeating itself. Higher values reduce the chance of the model repeating itself.
* **Maximum Number of Tokens**: Enter the maximum number of tokens used, which sets the completion length.
* **Response Format**: Choose **Text** or **JSON**. **JSON** ensures the model returns valid JSON.
* **Presence Penalty**: Use this option to control the chances of the model talking about new topics. Higher values increase the chance of the model talking about new topics.
* **Sampling Temperature**: Use this option to control the randomness of the sampling process. A higher temperature creates more diverse sampling, but increases the risk of hallucinations. The maximum is 2 for the **OpenAI** model family and 1 for the **Anthropic** model family.
* **Timeout**: Enter the maximum request time in milliseconds.
* **Max Retries**: Enter the maximum number of times to retry a request.
* **Top P**: Use this option to set the probability the completion should use. Use a lower value to ignore less probable options.
* **Extra Body**: Enter extra JSON properties to add to the request body. Use this for parameters that your deployment supports and the other options don't cover. The value must be a JSON object.

## Proxy limitations <a href="#proxy-limitations" id="proxy-limitations"></a>

This node doesn't support the [`NO_PROXY` environment variable](/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md).

## Templates and examples <a href="#templates-and-examples" id="templates-and-examples"></a>

[Browse Microsoft Foundry Chat Model node documentation integration templates](https://n8n.io/integrations/azure-openai-chat-model) or [search all templates](https://n8n.io/workflows/)

## Related resources <a href="#related-resources" id="related-resources"></a>

Refer to [LangChain's Azure OpenAI documentation](https://docs.langchain.com/oss/javascript/integrations/chat/azure) for more information about the service.

View n8n's [Advanced AI](/build/integrate-ai.md) documentation.

[^1]: AI agents are artificial intelligence systems capable of responding to requests, making decisions, and performing real-world tasks for users. They use large language models (LLMs) to interpret user input and make decisions about how to best process requests using the information and resources they have available.
