AzureAIOpenAIApiChatModel chat models.
The AzureAIOpenAIApiChatModel class uses the OpenAI-compatible API available in Azure AI Foundry. AI Foundry has several chat models, including AzureOpenAI, Cohere, Llama, Phi-3/4, and DeepSeek-R1, among others. You can find information about their latest models and their costs, context windows, and supported input types in the Azure docs.
Microsoft Foundry provides project-level access to models and Azure services. Use AzureAIOpenAIApiChatModel from langchain-azure-ai when your application uses a Foundry project, Azure credentials, or other Foundry capabilities.
Overview
Integration details
Model features
Setup
To accessAzureAIOpenAIApiChatModel models, you’ll need to create an Azure account, get an API key, and install the langchain-azure-ai integration package.
Credentials
Head to the Azure docs to see how to create your deployment and generate an API key. Once your model is deployed, you click the ‘get endpoint’ button in AI Foundry. This will show you your endpoint and api key. Once you’ve done this, set the environment variables:- Shell
- Python
Installation
The LangChainAzureAIOpenAIApiChatModel integration lives in the langchain-azure-ai package:
Instantiation
Now we can instantiate our model object and generate chat completions:- Project quickstart
- Model parameters
Invocation
Anthropic Claude models
UseAzureAIAnthropicChatModel to call Claude models deployed in Microsoft Foundry through the /anthropic endpoint with Microsoft Entra ID or API key authentication.
- Project endpoint
- Resource endpoint
project_endpoint and endpoint are omitted, AzureAIAnthropicChatModel resolves AZURE_AI_PROJECT_ENDPOINT, then FOUNDRY_PROJECT_ENDPOINT, as the project endpoint. If neither is set, it falls back to ANTHROPIC_FOUNDRY_RESOURCE as a bare Foundry resource name (for example, my-resource); pass full URLs via endpoint.
When credential is omitted, AzureAIAnthropicChatModel defaults to DefaultAzureCredential() and ignores OPENAI_API_KEY and ANTHROPIC_API_KEY. For API key authentication, pass credential="<your-api-key>" with endpoint or project_endpoint. Do not use init_chat_model("azure_ai:...") as it resolves to AzureAIOpenAIApiChatModel, not AzureAIAnthropicChatModel.
Connect these docs to your agent of choice via MCP for real-time answers.

