> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Foundry

> Configure Microsoft Foundry deployments and access them through TrueFoundry's AI Gateway.

Microsoft Foundry provides one account for Azure OpenAI models and models from other publishers, including Anthropic, Cohere, Meta, and Mistral. The integration is generally available in **TrueFoundry v0.175.0**. It uses the OpenAI-compatible v1 surface for compatible deployments and provider-specific routes where required.

Moving an existing Azure OpenAI or Azure AI Foundry account is covered in [Migrate to Microsoft Foundry](/docs/ai-gateway/migrate-to-microsoft-foundry). Hub and hub-based Azure resources cannot be migrated.

## Before you start

You need:

* A Microsoft Foundry resource with one or more deployed models.
* The resource's OpenAI endpoint.
* The project endpoint used for deployment discovery and provider-specific Foundry routes.
* An API key or one of the supported Azure identity authentication methods.
* A TrueFoundry API key for requests through the AI Gateway.

## Add a Microsoft Foundry account

**1. Open the Microsoft Foundry model account form**

In the TrueFoundry dashboard, open **AI Gateway** > **Models** and select **Microsoft Foundry**.

**2. Configure the resource**

Enter an account name, the Azure OpenAI endpoint, and the Microsoft Foundry project endpoint.

The OpenAI endpoint should be the resource URL, for example:

```text theme={"dark"}
https://my-resource.openai.azure.com
```

The project endpoint should include the project path, for example:

```text theme={"dark"}
https://my-resource.services.ai.azure.com/api/projects/my-project
```

![Microsoft Foundry Endpoints](https://mintcdn.com/truefoundry/azJhJKx5fXUK5Alg/images/docs/ai-gateway/microsoft-foundry-home-page.png?fit=max\&auto=format\&n=azJhJKx5fXUK5Alg\&q=85\&s=56b6d66972b0febe6b3e72a874023098)

**3. Configure authentication**

Configure authentication at the account level using an API key, certificate, client secret, or workload identity federation.

See the guides for [certificate authentication](/docs/ai-gateway/azure-entra-certificate-auth), [client secret authentication](/docs/ai-gateway/azure-entra-client-secret-auth), and [workload identity federation](/docs/ai-gateway/azure-entra-wif-auth).

**4. Add or discover deployments**

Use model discovery when the project endpoint is available, or add deployments manually.

A model integration uses:

* **Name**: the integration name used in Gateway model IDs.
* **Model ID**: the deployment name in Microsoft Foundry.
* **Foundation model**: the underlying model used for catalogue metadata and routing.
* **Deployment type**: `standard`, `global`, `datazone_us`, or `datazone_eu`.
* **Model types**: the operations supported by the deployment.

## Discover deployments

Model discovery reads deployments from the project endpoint. It uses the catalogue to infer model types and public cost metadata when the foundation model is known.

Discovery is stateless. Include the current integrations in the request so existing integration names remain stable and new names avoid collisions.

If the foundation model is not in the catalogue, the deployment is returned with `inferred.model_types: true` so you can select the model types manually.

## Call a Microsoft Foundry model

Gateway model IDs use the format:

```text theme={"dark"}
<provider-account-name>/<integration-name>
```

For example, if the account is `my-foundry` and the integration is `gpt-4.1`, use `my-foundry/gpt-4.1` in the request body:

```bash theme={"dark"}
curl "$GATEWAY_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $TFY_API_KEY" \
  -H "x-tfy-provider-name: my-foundry" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "my-foundry/gpt-4.1",
    "messages": [
      {"role": "user", "content": "Explain Microsoft Foundry in one sentence."}
    ]
  }'
```

The TrueFoundry API key authenticates the Gateway request. The Azure credential configured on the provider account authenticates the upstream Microsoft Foundry request.

## Supported operations

Microsoft Foundry models can use the following Gateway operations when the deployment and model integration declare the corresponding model type:

* Chat completions and legacy text completions
* Responses and Responses compaction
* Embeddings
* Image generation and image editing
* Text-to-speech, audio transcription, and audio translation
* Realtime WebSocket sessions
* Files, batches, and fine-tuning
* Cohere rerank
* Mistral Document AI OCR
* Anthropic Messages and Messages token counting for Claude deployments
* [Decision / System One](#decision-system-one) for Microsoft-Decision-1 deployments

### OpenAI-compatible deployments

OpenAI-compatible deployments use the `/openai/v1` upstream surface by default. The deployment name is sent as the upstream `model` value.

If a deployment does not support v1, set `api_version` on that model integration. TrueFoundry then uses the deployment-scoped Azure route with that API version.

### Claude deployments

Claude deployments use the native Anthropic Messages route. The provider account must include the project endpoint so TrueFoundry can reach the resource-level Anthropic surface.

Use a Gateway model ID such as:

```text theme={"dark"}
my-foundry/claude-opus-4-8
```

### Cohere rerank deployments

Cohere rerank deployments use the Foundry Cohere route. Select `rerank` as the model type and use the deployment name as the integration's `model_id`.

### Mistral Document AI OCR

Select `ocr` as the model type and call the existing Gateway OCR proxy. TrueFoundry derives the upstream Mistral OCR route from the provider account's `project_endpoint`.

```python theme={"dark"}
import base64
import requests

with open("document.pdf", "rb") as document:
    encoded_document = base64.b64encode(document.read()).decode("utf-8")

response = requests.post(
    "{GATEWAY_BASE_URL}/proxy/ocr",
    headers={
        "Authorization": "Bearer your-truefoundry-api-key",
        "Content-Type": "application/json",
    },
    json={
        "model": "my-foundry/mistral-document-ai",
        "document": {
            "type": "document_url",
            "document_url": f"data:application/pdf;base64,{encoded_document}",
        },
        "include_image_base64": True,
    },
)
response.raise_for_status()
print(response.json())
```

### Decision (System One)

Microsoft-Decision-1 deployments answer typed System One questions. Azure does not let you name a deployment `Microsoft-Decision-1`, so deploy it under another name and set:

* **Model ID**: your deployment name
* **Foundation model**: `Microsoft-Decision-1`
* **Model Types**: **Decision**

Call `POST /v1/systemone` or `POST /v1/decisions`. Upstream, the AI Gateway posts to `{resource}/providers/microsoft/v1/systemone`. Full docs: [Decisions API](/docs/ai-gateway/decisions).

```python Python lines theme={"dark"}
import os

import requests

gateway_base_url = os.environ["GATEWAY_BASE_URL"].rstrip("/")
response = requests.post(
    f"{gateway_base_url}/v1/systemone",
    headers={"Authorization": f"Bearer {os.environ['TFY_API_KEY']}"},
    json={
        "model": "my-foundry/decision-1",
        "state": "I was charged twice for order #4411 and want a refund.",
        "questions": {
            "is_refund_request": {
                "type": "noul",
                "instructions": "Is the customer asking for a refund?",
            }
        },
    },
    timeout=60,
)
response.raise_for_status()
print(response.json()["answers"]["is_refund_request"])
```

### Realtime models

Realtime models use the Gateway WebSocket endpoint:

```text theme={"dark"}
ws://<gateway-host>/live/<provider-account-name>?model=<integration-name>
```

For example:

```text theme={"dark"}
wss://gateway.example.com/live/my-foundry?model=gpt-realtime
```

The provider account is already present in the URL, so the realtime query parameter is the integration name rather than the full Gateway model FQN.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.