# AzureAIChatCompletionsModel

> **Class** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel)

Azure AI Chat Completions Model.

This class has been deprecated in favor of `AzureAIOpenAIApiChatModel`.

The Azure AI model inference API (https://aka.ms/azureai/modelinference)
provides a common layer to talk with most models deployed to Azure AI. This class
providers inference for chat completions models supporting it. See documentation
for the list of models supporting the API.

**Examples:**

```python
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel
from langchain_core.messages import HumanMessage, SystemMessage

model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].services.ai.azure.com/models",
    credential="your-api-key",
    model="mistral-large-2407",
)

messages = [
    SystemMessage(
        content="Translate the following from English into Italian"
    ),
    HumanMessage(content="hi!"),
]

model.invoke(messages)
```

For serverless endpoints running a single model, the `model_name` parameter
can be omitted:

```python
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel
from langchain_core.messages import HumanMessage, SystemMessage

model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].inference.ai.azure.com",
    credential="your-api-key",
)

messages = [
    SystemMessage(
        content="Translate the following from English into Italian"
    ),
    HumanMessage(content="hi!"),
]

model.invoke(messages)
```

You can pass additional properties to the underlying model, including
`temperature`, `top_p`, `presence_penalty`, etc.

```python
model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].services.ai.azure.com/models",
    credential="your-api-key",
    model="mistral-large-2407",
    temperature=0.5,
    top_p=0.9,
)

Azure OpenAI models require to pass the route `openai/v1`.

```python
model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].services.ai.azure.com/openai/v1",
    model="gpt-4.1",
    credential="your-api-key",
)
```

**Structured Output:**

To use structured output with Azure AI models, you can use the
`with_structured_output` method. This method supports the same methods
as the base class, including `function_calling`, `json_mode`, and
`json_schema`.

```python
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel
from langchain_core.output_parsers import JsonOutputParser
from langchain_core.messages import HumanMessage

class Joke(BaseModel):
    joke: str

model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].services.ai.azure.com/models",
    credential="your-api-key",
    model="mistral-large-2407",
).with_structured_output(Joke, method="json_schema")

!!! note
    Using `method="function_calling"` requires the model to support
    function calling and `tool_choice". Use "json_mode" or
    "json_schema" for best support.

**Troubleshooting:**

To diagnostic issues with the model, you can enable debug logging:

```python
import sys
import logging
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel

logger = logging.getLogger("azure")

# Set the desired logging level. logging.
logger.setLevel(logging.DEBUG)

handler = logging.StreamHandler(stream=sys.stdout)
logger.addHandler(handler)

model = AzureAIChatCompletionsModel(
    endpoint="https://[your-service].services.ai.azure.com/models",
    credential="your-api-key",
    model="mistral-large-2407",
    client_kwargs={ "logging_enable": True }
)
```

## Signature

```python
AzureAIChatCompletionsModel()
```

## Extends

- `BaseChatModel`
- `ModelInferenceService`

## Properties

- `model_name`
- `max_tokens`
- `temperature`
- `top_p`
- `presence_penalty`
- `frequency_penalty`
- `stop`
- `seed`
- `model_kwargs`

## Methods

- [`initialize_client()`](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel/initialize_client)
- [`bind_tools()`](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel/bind_tools)
- [`with_structured_output()`](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel/with_structured_output)
- [`get_lc_namespace()`](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel/get_lc_namespace)
- [`aclose()`](https://reference.langchain.com/python/langchain-azure-ai/chat_models/inference/AzureAIChatCompletionsModel/aclose)

## ⚠️ Deprecated

Deprecated since version 1.1.0. Use langchain_azure_ai.chat_models.AzureAIOpenAIApiChatModel instead. AzureAIChatCompletionsModel requires Azure AI Inference beta SDK which is deprecated and will be retired on May 30, 2026. Please migrate to AzureAIOpenAIApiChatModel which uses OpenAI-compatible API with a stable OpenAI SDK.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/chat_models/inference.py#L312)