Description
There is currently no code sample or documentation for the image-to-image (img2img) use case with the FLUX.2-pro model deployed on Azure AI Foundry.
The only available samples demonstrate text-to-image generation (/openai/deployments/{deployment}/images/generations), but there is no guidance on how to perform image editing / image variation — where the input is both an image AND a text prompt.
Current Sample Code in AI Foundry
Expected Behavior
Azure AI Foundry should provide:
- A code sample (Python) demonstrating how to send an input image along with a text prompt to the FLUX.2-pro deployment to generate a modified/edited version of the input image.
- REST API documentation specifying:
- The correct endpoint path (e.g.,
/images/edits or a parameter in /images/generations)
- How to pass the input image (base64 in JSON body, multipart form data, image URL, etc.)
- Supported API versions for this feature
- Any model-specific parameters for controlling edit strength, guidance scale, etc.
Current Behavior
- The FLUX.2-pro model is deployed successfully as a
GlobalStandard deployment on Azure AI Foundry.
- Text-to-image generation works via
POST /openai/deployments/FLUX.2-pro/images/generations.
- Attempting to use
/openai/deployments/FLUX.2-pro/images/edits (similar to DALL-E edit API) returns 404 Resource not found.
- There is no documented way to include an input/reference image in the request payload.
Steps to Reproduce
- Deploy FLUX.2-pro model on Azure AI Foundry (GlobalStandard deployment).
- Attempt to call the image edit endpoint:
import httpx
endpoint = "https://<resource>.cognitiveservices.azure.com"
deployment = "FLUX.2-pro"
api_key = "<your-api-key>"
# Attempt 1: /images/edits endpoint (returns 404)
url = f"{endpoint}/openai/deployments/{deployment}/images/edits?api-version=2024-05-01-preview"
headers = {"api-key": api_key}
files = {"image": ("input.png", image_bytes, "image/png")}
data = {"prompt": "Change the background to a sunset", "n": "1", "size": "1024x1024"}
response = httpx.post(url, data=data, files=files, headers=headers)
print(response.status_code) # 404
# Attempt 2: /images/generations with image in body (no documented parameter for input image)
url = f"{endpoint}/openai/deployments/{deployment}/images/generations?api-version=2024-05-01-preview"
headers = {"Content-Type": "application/json", "api-key": api_key}
payload = {
"prompt": "Change the background to a sunset",
"n": 1,
"size": "1024x1024",
# How to include the input image? No documentation available.
}
response = httpx.post(url, json=payload, headers=headers)
# Works but generates from scratch — doesn't use input image
Environment
- Model: FLUX.2-pro (v1, by Black Forest Labs)
- Deployment type: GlobalStandard
- Resource type: Azure AI Foundry (cognitiveservices.azure.com)
- API versions tested:
2024-05-01-preview, 2025-04-01-preview
Suggested Solution
- If img2img is supported: Add a code sample to the [Azure AI Foundry SDK samples Code] showing how to pass an input image to FLUX.2-pro for editing/variation.
- If img2img is NOT yet supported: Document this limitation clearly in the FLUX.2-pro model card on Azure AI Foundry, and provide an ETA or roadmap for when image-to-image support will be available.
Additional Context
FLUX.2-pro natively supports image-to-image generation (as documented on Black Forest Labs). The Azure deployment should ideally expose this capability through the REST API.
Description
There is currently no code sample or documentation for the image-to-image (img2img) use case with the FLUX.2-pro model deployed on Azure AI Foundry.
The only available samples demonstrate text-to-image generation (
/openai/deployments/{deployment}/images/generations), but there is no guidance on how to perform image editing / image variation — where the input is both an image AND a text prompt.Current Sample Code in AI Foundry
Expected Behavior
Azure AI Foundry should provide:
/images/editsor a parameter in/images/generations)Current Behavior
GlobalStandarddeployment on Azure AI Foundry.POST /openai/deployments/FLUX.2-pro/images/generations./openai/deployments/FLUX.2-pro/images/edits(similar to DALL-E edit API) returns 404 Resource not found.Steps to Reproduce
Environment
2024-05-01-preview,2025-04-01-previewSuggested Solution
Additional Context
FLUX.2-pro natively supports image-to-image generation (as documented on Black Forest Labs). The Azure deployment should ideally expose this capability through the REST API.