Edit

Endpoints for Microsoft Foundry Models

Microsoft Foundry Models provides access to a wide variety of models from many providers through a single endpoint and set of credentials. This capability lets you switch between models and use them in your application without making code changes.

This article explains how the Foundry services organize models and how to use the inference endpoint to access them.

Important

Azure AI Inference beta SDK is deprecated and will be retired on August 26, 2026. Switch to the generally available OpenAI/v1 API with a stable OpenAI SDK. Follow the migration guide to switch to OpenAI/v1, using the SDK for your preferred programming language.

Prerequisites

Deployments

Foundry uses deployments as aliases for model access. A deployment gives a model a name and a set of configurations. You access a model by using its deployment name in your requests.

A deployment defines:

  • A model name
  • A model version
  • A provisioning or capacity type1
  • A content filtering configuration1
  • A rate limiting configuration1

1 These configurations can change depending on the selected model.

A Foundry resource can have many model deployments. You only pay for inference performed on model deployments. Deployments are Azure resources, so they're subject to Azure policies.

For more information about creating deployments, see Add and configure model deployments.

Azure OpenAI inference endpoint

The Azure OpenAI API exposes the full capabilities of OpenAI models and supports more features like assistants, threads, files, and batch inference. You can also use it to access non-OpenAI models.

Azure OpenAI endpoints are formatted as https://<resource-name>.openai.azure.com. Endpoints map to deployments, and each deployment has its own associated URL. However, you can use the same authentication mechanism to consume more than one deployment. For more information, see the reference page for Azure OpenAI API.

An illustration showing how Azure OpenAI deployments contain a single URL for each deployment.

Deployment URLs are formed by concatenating the Azure OpenAI base URL and the route /deployments/<model-deployment-name>. When you use the OpenAI v1 API, call the /openai/v1/ route on the base URL, https://<resource-name>.openai.azure.com/openai/v1/, and pass the deployment name in the model field of your request. The /openai/v1/ route uses implicit versioning, so you don't pass an api-version.

The following examples use the Responses API, which supports the latest inference features.

Note

The Responses API works with Azure OpenAI models and with Foundry Models sold by Azure that support it, such as DeepSeek, Llama, and Grok models. If a deployment doesn't support the Responses API, the request returns 400 Model not supported. In that case, use the Chat Completions API by calling client.chat.completions.create instead.

Use API key authentication

You can authenticate inference requests with an API key from your Foundry resource. API keys are quick to set up, but they grant full access to the resource, are hard to scope to specific users or actions, and require manual rotation to stay secure. For production workloads, use keyless authentication with Microsoft Entra ID instead.

In the following example, deepseek-v3-0324 is the name of a model deployment in the Microsoft Foundry resource. Replace it with your own deployment name, and store your API key in the AZURE_INFERENCE_CREDENTIAL environment variable.

Install the openai package by using pip:

pip install openai --upgrade

Create a client that points to the Azure OpenAI v1 endpoint, and then generate a response. The /openai/v1/ route uses implicit versioning, so you don't pass an api-version. Pass your deployment name in the model field:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://<resource>.openai.azure.com/openai/v1/",
    api_key=os.environ["AZURE_INFERENCE_CREDENTIAL"],
)

response = client.responses.create(
    model="deepseek-v3-0324",  # Replace with your model deployment name.
    input="Explain the Riemann hypothesis in one paragraph.",
)

print(response.output_text)

For more information about how to use the Azure OpenAI endpoint, see Azure OpenAI SDK language support.

Use keyless authentication

Deployed Foundry Models support keyless authorization with Microsoft Entra ID. Keyless authorization enhances security, simplifies the user experience, reduces operational complexity, and provides robust compliance support. Use keyless authorization if your organization uses secure and scalable identity management solutions.

To use keyless authentication, configure your resource and grant access to users to perform inference. After you configure the resource and grant access, authenticate as follows:

Install the OpenAI SDK using a package manager like pip:

pip install openai

For Microsoft Entra ID authentication, also install:

pip install azure-identity

Use the package to consume the model. The following example shows how to create a client and make a test call to the Responses API by using Microsoft Entra ID and your model deployment.

Replace <resource> with your Foundry resource name. Find it in the Azure portal or by running az cognitiveservices account list. Replace deepseek-v3-0324 with your actual deployment name.

from openai import OpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider

token_provider = get_bearer_token_provider(
    DefaultAzureCredential(), 
    "https://ai.azure.com/.default"
)

client = OpenAI(
    base_url="https://<resource>.openai.azure.com/openai/v1/",
    api_key=token_provider,
)

response = client.responses.create(
    model="deepseek-v3-0324",  # Replace with your model deployment name.
    input="What is Azure AI?",
)

print(response.output_text)

Expected output

Azure AI is a comprehensive suite of artificial intelligence services and tools from Microsoft that enables developers to build intelligent applications. It includes services for natural language processing, computer vision, speech recognition, and machine learning capabilities.

Reference: OpenAI Python SDK and DefaultAzureCredential class.