> ## Documentation Index
> Fetch the complete documentation index at: https://hobbyist-e43fa225.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy and use MedImageInsight Premium in Foundry

> Deploy MedImageInsight Premium in Microsoft Foundry and send a test request to generate medical image and text embeddings for evaluation workflows.

<Info>
  The healthcare AI models marked (preview) in this article are currently in *limited preview*. These models are intended and provided as-is for research and model development exploration. The healthcare AI models are not designed or intended to be deployed in clinical settings as-is. They are not intended for use in the diagnosis or treatment of any health or medical condition, and the individual models' performances for such purposes have not been established.

  You bear sole responsibility and liability for any use of the healthcare AI models, including verification of outputs and incorporation into any product or service intended for a medical purpose or to inform clinical decision-making, compliance with applicable healthcare laws and regulations, and obtaining any necessary clearances or approvals.
</Info>

In this article, you deploy MedImageInsight Premium (preview) and send a test request to generate medical image and text embeddings. MedImageInsight Premium generates rich, semantically meaningful embeddings of medical images across nine imaging modalities, including X-ray, CT, MRI, ultrasound, dermatology, ophthalmology, pathology, mammography.

MedImageInsight Premium provides assistive model output for medical imaging workflows. Treat embeddings, similarity scores, classifications, and retrieval results as workflow inputs that still require appropriate testing, validation, monitoring, and human governance before use in clinical contexts. For more details about the model, see [Learn more about the model](#learn-more-about-the-model).

<Note>
  Registration is required to use [MedImageInsight Premium](https://aka.ms/MI2Premium). Access will be granted according to Microsoft's eligibility criteria. To request access, submit [this form](https://aka.ms/microsoft/medimageinsight-premium).
</Note>

## Prerequisites

* An Azure subscription with access to Microsoft Foundry. If you don't have one, [create one for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
* A Foundry project. If you don't have one, [create a project](../create-projects).
* Permission to view models and create or use deployments in your project.
* Access to deploy MedImageInsight Premium in the model catalog for your project. To request access, submit [this form](https://aka.ms/microsoft/medimageinsight-premium).
* Required role-based access control for model deployment and endpoint use. For details, see [Role-based access control in Foundry portal](../../concepts/rbac-foundry).
* A test image or small test set for evaluation.
* A client for test calls, such as REST tooling or an SDK-capable app environment.

## Deploy MedImageInsight Premium in Foundry

Deploy the model from the Foundry model catalog so that you can invoke it from
your application or test client.

1. Sign in to [Microsoft Foundry](https://ai.azure.com/?cid=learnDocs). Make sure the **New Foundry** toggle is on. These steps refer to **Foundry (new)**.

<img src="https://mintcdn.com/hobbyist-e43fa225/_qpHdwibkfCcXaky/images/new-foundry.png?fit=max&auto=format&n=_qpHdwibkfCcXaky&q=85&s=1338a0cf43c92807e8bcccdd0223d052" width="184" height="36" data-path="images/new-foundry.png" />

1. Select your subscription and Foundry resource.
2. Select **Discover** > **Models**.
3. Search for **MedImageInsight Premium** and open the model card.
4. Select **Deploy**.
5. Review the available terms and deployment settings in your tenant.
6. Enter a deployment name and create the deployment.
7. Wait for deployment status to show **Succeeded**.
8. Copy the endpoint URL, deployment identifier, and authentication settings.

<Note>
  If deployment fails, check [Known issues in Microsoft Foundry](../../reference/foundry-known-issues) for current limitations and workarounds. Common causes include missing role assignments, region mismatch, and offer access that isn't enabled for your tenant.
</Note>

## Test the deployment

After deployment succeeds, you can validate the endpoint by sending test requests with text or image inputs to generate embeddings.

### Sample request payload

Send a `POST` to `/providers/microsoft/v2/embed` on your deployment URL. Use the `texts` field for text inputs or the `images` field for images encoded as base64 data URIs.

<CodeGroup>
  ```http REST theme={null}
      POST https://<your-endpoint>/providers/microsoft/v2/embed
      Authorization: Bearer <your-api-key>
      Content-Type: application/json

      {
        "model": "MedImageInsight-Premium",
        "texts": ["x-ray chest anteroposterior Atelectasis."]
      }
  ```

  ```python Python theme={null}
      import requests

      base = "https://<your-endpoint>"
      url = f"{base.rstrip('/')}/providers/microsoft/v2/embed"
      headers = {"Authorization": "Bearer <your-api-key>"}

      resp = requests.post(
          url,
          json={
              "model": "MedImageInsight-Premium",
              "texts": ["x-ray chest anteroposterior Atelectasis."],
          },
          headers=headers,
          timeout=60,
      )
      resp.raise_for_status()
      embeddings = resp.json()["embeddings"]["float"]
  ```
</CodeGroup>

## Reference for REST API

The following API reference shows the request payload, headers, response schema, and error codes for the MedImageInsight Premium embedding endpoint. Use it to send authenticated requests, confirm your deployment is reachable, and as a reference to build applications using the API.

### Request headers

* `Authorization: Bearer <your-api-key>`
* `Content-Type: application/json`

### Request body

| Field             | Type         | Required    | Default     | Description                                                                                                         |
| ----------------- | ------------ | ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| `model`           | string       | Yes         | —           | Served model name for the deployment.                                                                               |
| `texts`           | string array | Conditional | —           | Text inputs to embed. Provide `texts` or `images`.                                                                  |
| `images`          | string array | Conditional | —           | Images as base64 data URIs (for example, `data:image/png;base64,...`). Provide `texts` or `images`.                 |
| `embedding_types` | string array | No          | `["float"]` | Accepted values: `float` (recommended), `binary`, `ubinary`, `base64`. See [Embedding formats](#embedding-formats). |

* **One modality per request.** Provide `texts` or `images`, not both. If both fields are present, the endpoint silently processes one and ignores the other.
* **Batching is supported.** You can send multiple items in a single call. The response returns one vector per item, ordered to match the input array.
* **Supported image formats:** PNG and JPEG.
* **Image preparation.** If your source data is DICOM, convert it before sending. The model expects single 2D images; for volumetric studies (CT, MRI), select the relevant slice and apply standard windowing for the modality before encoding. For reference DICOM-to-image conversion and modality-specific preprocessing utilities, see the [Healthcare AI Examples](https://aka.ms/HealthcareAIExamples) repository.

#### Embedding formats

The response key matches the requested type (for example, `embeddings.binary` when you request `binary`).

* **`float`** (recommended): list of 1024 float values per vector. The canonical embedding.
* **`base64`**: the float vector encoded as raw float32 bytes, base64-encoded. Lossless equivalent of `float`, smaller wire payload.
* **`binary`** / **`ubinary`**: 128 bytes per vector — the 1024 sign bits of the float vector, packed 8 per byte. 32× smaller but lossy (only preserves sign). Suitable for fast approximate similarity search using Hamming distance.

**Minimal text-only request**

```json theme={null}
{
  "model": "MedImageInsight-Premium",
  "texts": ["x-ray chest anteroposterior Atelectasis."]
}
```

**Full image-embedding request**

```json theme={null}
{
  "model": "MedImageInsight-Premium",
  "images": ["data:image/png;base64,<base64-encoded-image>"]
}
```

### Response body

| Field              | Type                  | Description                                                                                                                                                               |
| ------------------ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `embeddings.float` | array of float arrays | List of embedding vectors. Each vector is a list of 1024 floating-point numbers. The outer list has one vector per input item, ordered to match your `texts` or `images`. |
| `id`               | string                | Unique identifier for the request.                                                                                                                                        |
| `texts`            | string array          | Echo of the input texts, if provided.                                                                                                                                     |
| `meta`             | object                | Request metadata including API version and billed units.                                                                                                                  |
| `response_type`    | string                | Response format identifier.                                                                                                                                               |

```json theme={null}
{
  "id": "...",
  "embeddings": {
    "float": [[0.0123, -0.0456, "... (1024 floats total)"]]
  },
  "texts": ["x-ray chest anteroposterior Atelectasis."],
  "meta": { ... },
  "response_type": "embeddings_by_type"
}
```

### Response codes

| Status         | Condition                                                                                                                                                                        |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200`          | Request succeeded.                                                                                                                                                               |
| `400`          | Missing or invalid request field. Confirm that `model` is present, `images` values use the `data:image/...;base64,` prefix, and any provided `embedding_types` values are valid. |
| `401` or `403` | Confirm that you're using a key for the same resource as the endpoint.                                                                                                           |
| `404`          | Confirm that the endpoint starts with `https://` and matches the endpoint shown for your deployment.                                                                             |

## Learn more about the model

MedImageInsight Premium (preview) generates rich, semantically meaningful embeddings of medical images across nine imaging modalities, including X-ray, CT, MRI, ultrasound, dermatology, ophthalmology, pathology, mammography. These embeddings power downstream workflows: similarity search, classification, outlier detection, drift monitoring, dataset curation, and multimodal retrieval-augmented generation. Outputs are intermediate signals that feed into a customer-built application; they are never a clinical determination on their own.

The premium model is a closed-weight, [serverless](/models/foundry-models-overview#serverless-deployments) offering with expanded capabilities and improved performance. For more information about differences between legacy and Premium models, see [Legacy and Premium healthcare models](https://aka.ms/HLSPremiumModels).

For license, transparency, and intended-use details, see the [MedImageInsight Premium model card](https://aka.ms/MI2Premium).

## Common use cases

Each of the following use cases assumes qualified human review as part of the workflow before any approval or action occurs

* Image similarity search across hospital PACS archives
* Dataset curation and triage for AI/ML pipelines
* Outlier detection and study-level QA
* Drift monitoring for deployed imaging models
* Embedding-based classification for narrow downstream tasks (fracture detection, lesion characterization, modality routing)

<Frame>
  <img src="https://mintcdn.com/hobbyist-e43fa225/3WuAb43ojvr9EroY/images/healthcare-embedding-capabilities.gif?s=595de6c1a075ce1724dc7e21fd4c478f" alt="Animated diagram that shows an embedding model supporting similarity search and quality control scenarios." width="900" height="506" data-path="images/healthcare-embedding-capabilities.gif" />
</Frame>

<Tip>
  For runnable code examples covering zero-shot classification, adapter training, outlier detection, and more, see the [Healthcare AI Examples](https://aka.ms/HealthcareAIExamples) repository on GitHub.
</Tip>

## Review safety requirements

MedImageInsight Premium (preview) generates embeddings for medical images and text in a shared latent space, suitable for similarity search, retrieval, and downstream classification workflows.

MedImageInsight Premium is a model service, not a standalone clinical
application. It's intended for organizations and developers building
healthcare imaging solutions, including healthcare providers, independent
software vendors, systems integrators, partners, enterprise AI teams, and data
science teams. The service is hosted and accessed by authenticated endpoints;
customers don't receive raw model weights.

Embedding outputs can support powerful workflows, but they don't provide
definitive clinical truth. Model performance can vary based on data
representativeness, modality, acquisition parameters, workflow design,
site-specific practice, prompt wording, preprocessing, image quality, and
distribution shift.

Before implementation, define your workflow controls:

1. Validate that the model is fit for your intended use, modalities, and data sources.
2. Keep appropriate human governance and review in workflows where outputs inform decisions.
3. Evaluate performance on representative data before use and after material workflow changes.
4. Monitor data drift, out-of-distribution behavior, quality, fairness, and operational performance over time.
5. Confirm privacy, security, retention, logging, and access controls for sensitive healthcare data.

Use MedImageInsight Premium only in assistive workflows with appropriate human
oversight. It isn't intended for:

* Out-of-the-box clinical use
* Autonomous clinical decision-making.
* Use without qualified human oversight where outputs inform health or medical decisions.
* Treating similarity scores, embeddings, classifications, or search results as definitive clinical truth without validation.
* Use cases that require guarantees of perfect accuracy, completeness, fairness, or stability across all populations, devices, sites, or imaging protocols.
* Emergency, triage, or time-critical workflows unless your organization has independently validated the complete workflow and implemented appropriate controls.
* Any workflow where model output could be acted on without mitigation for performance variability, drift, or data quality issues.

## Data, privacy, and security considerations

MedImageInsight Premium might be used in workflows that involve sensitive
healthcare data, including medical images and associated text. You are
responsible for configuring and operating your applications to meet privacy,
security, compliance, and data governance obligations.

Use of MedImageInsight Premium is subject to the preview license and might
also be subject to other terms and conditions. For licensing information, see
the [MedImageInsight Premium model card](https://aka.ms/MI2Premium).

## Related content

* [Healthcare AI examples (GitHub)](https://aka.ms/HealthcareAIExamples)
* [How to use MedImageInsight healthcare AI model for medical image embedding generation (classic)](https://learn.microsoft.com/en-us/azure/foundry-classic/how-to/healthcare-ai/deploy-medimageinsight)
* [Customize a premium healthcare AI model with fine-tuning](/models/fine-tune-premium-healthcare-models)
* [Model catalog and collections in Foundry portal](/models/foundry-models-overview)
* [Authentication and authorization options in Foundry](../../concepts/rbac-foundry)
* [Integrate Microsoft Foundry with your applications](/models/integrate-with-other-apps)
