> ## 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 CxrReportGen Premium in Foundry

> Deploy CxrReportGen Premium in Microsoft Foundry and send a test request to generate assistive draft findings from chest X-ray studies.

<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 CxrReportGen Premium (preview) and send a test request to generate draft chest X-ray findings for qualified human review.

CxrReportGen Premium is an AI model checkpoint for building systems that draft structured radiology reports from chest X-ray inputs. The model provides assistive draft output. Treat generated findings as preliminary content that still requires appropriate testing, validation, monitoring, and human governance before use in clinical contexts. For more details about this mode, see [Learn more about the model](#learn-more-about-the-model).

<Note>
  Registration is required to use [CxrReportGen Premium](https://aka.ms/CXRRGV2Premium). Access will be granted according to Microsoft's eligibility criteria. To request access, submit [this form](https://aka.ms/microsoft/cxrreportgen-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 CxrReportGen Premium in the model catalog for your project. To request access, submit [this form](https://aka.ms/microsoft/cxrreportgen-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 chest X-ray study and allowed metadata for evaluation.
* A client for test calls, such as REST tooling or an SDK-capable app environment.

## Deploy CxrReportGen 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 **CxrReportGen 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 a test request with a chest X-ray image to generate draft findings.

### Sample request payload

CXRReportGen Premium exposes a `POST /providers/microsoft/v1/inference` endpoint that accepts a flat JSON body.

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

      {
        "model": "CXRReportgen-Premium",
        "current_image": "<base64-encoded-image>"
      }
  ```

  ```python Python theme={null}
      import base64
      from pathlib import Path
      import requests

      base = "https://<your-endpoint>"
      url = f"{base.rstrip('/')}/providers/microsoft/v1/inference"
      headers = {
          "Authorization": "Bearer <your-api-key>",
          "Content-Type": "application/json",
      }

      current_image_b64 = base64.b64encode(Path("current.png").read_bytes()).decode()

      resp = requests.post(
          url,
          json={
              "model": "CXRReportgen-Premium",
              "current_image": current_image_b64,
          },
          headers=headers,
          timeout=120,
      )
      resp.raise_for_status()
      print(resp.json()["findings"])
  ```
</CodeGroup>

## Reference for REST API

The following API reference shows the request payload, headers, response schema, and error codes for the CxrReportGen Premium inference 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. Use `CXRReportgen-Premium`.                                                      |
| `current_image`             | base64 string | Yes      | —       | Frontal chest X-ray image (AP or PA view).                                                                             |
| `prior_image`               | base64 string | No       | —       | Prior frontal chest X-ray (AP or PA view).                                                                             |
| `prior_report`              | string        | No       | —       | Prior radiology report text.                                                                                           |
| `indication`                | string        | No       | —       | Clinical indication.                                                                                                   |
| `technique`                 | string        | No       | —       | Imaging technique.                                                                                                     |
| `comparison`                | string        | No       | —       | Comparison statement.                                                                                                  |
| `max_tokens`                | integer       | No       | `450`   | Maximum tokens to generate.                                                                                            |
| `temperature`               | float         | No       | `0.0`   | Sampling temperature. `0.0` selects greedy decoding.                                                                   |
| `text_normalize_unicode`    | string        | No       | `both`  | Apply Unicode NFKC normalization to the listed scope. Allowed values: `both`, `current`, `prior`, `none`.              |
| `text_normalize_whitespace` | string        | No       | `both`  | Collapse runs of whitespace to a single space in the listed scope. Allowed values: `both`, `current`, `prior`, `none`. |
| `text_normalize_strip`      | string        | No       | `both`  | Strip leading/trailing whitespace in the listed scope. Allowed values: `both`, `current`, `prior`, `none`.             |

* **Supported image formats:** PNG and JPEG.
* **Image preparation.** If your source data is DICOM, convert each chest X-ray to a single PNG or JPEG and apply standard windowing before encoding. For reference DICOM-to-image conversion utilities, see the [Healthcare AI Examples](https://aka.ms/HealthcareAIExamples) repository.
* **Prior context is paired.** `prior_image` and `prior_report` must both be present and non-empty. If only one is sent, both are ignored by the model. Send each image once; don't duplicate.
* **Pass bare values** for `indication`, `technique`, and `comparison`. Don't include the field name in the value. For example, send `"indication": "Cough"`, not `"indication": "Indication: Cough"`.
* **Omit fields you don't have.** Send `null` or leave the key out. Don't send an empty string (`""`), which adds a labeled-but-empty field to the prompt.
* **Text normalization scope.** `current` covers `indication`, `technique`, `comparison`; `prior` covers `prior_report`; `both` covers all; `none` disables normalization.

**Minimal image-only request**

```json theme={null}
{
  "model": "CXRReportgen-Premium",
  "current_image": "<base64-encoded-image>"
}
```

**Full request with context and prior study**

```json theme={null}
{
  "model": "CXRReportgen-Premium",
  "current_image": "<base64-encoded-current-image>",
  "indication": "Shortness of breath",
  "technique": "Single frontal view",
  "comparison": "Comparison is made to prior study dated 2024-01-01.",
  "prior_image": "<base64-encoded-prior-image>",
  "prior_report": "Lungs are clear. No pleural effusion.",
  "max_tokens": 512,
  "temperature": 0.0
}
```

### Response body

| Field      | Type   | Description                                                                                                                                                 |
| ---------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `findings` | string | Generated draft findings text.                                                                                                                              |
| `model`    | string | Identifier of the served model on the deployment. This value is the internal served-model name and won't match the deployment name you sent in the request. |
| `usage`    | object | Token counts: `prompt_tokens`, `completion_tokens`, `total_tokens`.                                                                                         |

```json theme={null}
{
  "findings": "Findings: ... Impression: ...",
  "model": "...",
  "usage": {
    "prompt_tokens": 1024,
    "completion_tokens": 87,
    "total_tokens": 1111
  }
}
```

### Response codes

| Status         | Condition                                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `200`          | Request succeeded.                                                                                                      |
| `400`          | Missing or invalid request field. Confirm that `model` is present in the request body.                                  |
| `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.                    |
| `422`          | Invalid or missing image data. Confirm that `current_image` is present and contains a valid base64-encoded PNG or JPEG. |

## Learn more about the model

CxrReportGen Premium is an AI model checkpoint for building systems that draft structured radiology reports from chest X-ray inputs. It integrates clinical context such as indication, technique, comparison study, and prior reports. It is purpose-built to slot into existing radiology workflows as a first-pass draft that a qualified clinician then reviews, corrects, and finalizes. The model is not a medical device and is not intended to deliver autonomous reports or to inform clinical decision-making on its own.

The Premium model is a closed-weight, [serverless](/models/foundry-models-overview#serverless-deployments) offering with improved draft quality and expanded capabilities. 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 [CxrReportGen Premium model card](https://aka.ms/CXRRGV2Premium).

## Common use cases

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

* First-pass chest X-ray draft reports for a radiologist to edit and approve
* Structured findings extraction for downstream coding and reimbursement
* Triage and prioritization signals in high-volume reading rooms
* Resident and trainee feedback and quality review under attending supervision
* Embedding inside ISV radiology products that surface CxrReportGen drafts

<Frame>
  <img src="https://mintcdn.com/hobbyist-e43fa225/nz5wZMFrer95hQ_4/images/cxrreportgen-capabilities.gif?s=2bc4684e6aae54cca052e38eb6cd5c67" alt="Animated diagram that shows generations of findings from a chest x-ray." width="1536" height="1024" data-path="images/cxrreportgen-capabilities.gif" />
</Frame>

<Tip>
  For runnable notebooks and code examples, see the [Healthcare AI Examples](https://aka.ms/HealthcareAIExamples) repository on GitHub.
</Tip>

## Review safety requirements

The model output is generated text findings, which can contain errors or
omissions.

CxrReportGen 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, and enterprise AI teams. The
service is hosted and accessed by authenticated endpoints; customers don't
receive raw model weights.

Before implementation, define your workflow controls:

1. Out-of-the-box clinical use
2. Keep qualified professionals in the loop for review and sign-off.
3. Validate model and end-to-end workflow performance on representative data.
4. Require source-image review for clinically relevant decisions.
5. Maintain feedback and incident response paths for unexpected outputs.
6. Confirm privacy, security, retention, logging, and access controls for sensitive healthcare data.

Use CxrReportGen Premium only in assistive workflows with qualified human
review. It isn't intended for:

* Autonomous clinical decision-making.
* Producing final radiology reports without professional validation and sign-off.
* Use cases that require guarantees of perfect accuracy, completeness, or fairness.
* Emergency, triage, or time-critical workflows unless your organization has independently validated the complete workflow and implemented appropriate controls.
* Any workflow where errors or omissions in generated text could be acted on without mitigation.

## Data, privacy, and security considerations

CxrReportGen 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 CxrReportGen Premium is subject to the preview license and might
also be subject to other terms and conditions. For licensing information, see
the [CxrReportGen Premium model card](https://aka.ms/CXRRGV2Premium).

## Related content

* [Healthcare AI examples (GitHub)](https://aka.ms/HealthcareAIExamples)
* [How to use CxrReportGen healthcare AI model to generate grounded findings (classic)](https://learn.microsoft.com/en-us/azure/foundry-classic/how-to/healthcare-ai/deploy-CxrReportGen)
* [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)
