Foundry API: Black Forest Labs Mismatch

Anthony 0 Reputation points
2026-04-15T04:57:17.37+00:00

I'm currently using Foundry to host the Black Forest Labs model, FLUX.2-pro.

Under this page, https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure?tabs=global-standard-aoai%2Cglobal-standard&pivots=azure-direct-others,
it states the API should be the same as Black Forest Lab's API, found here: https://docs.bfl.ai/flux_2/flux2_image_editing

For the parameter "input_image", a string type, it states it is:
"Base64 encoded image or URL of image to use as reference. Supports up to 20MB or 20 megapixels. Input resolution: minimum 64x64, recommended up to 2MP, maximum 4MP (e.g., 2048x2048). Dimensions must be multiples of 16."

However, when I invoke the a request to the target URI endpoint for the model, I get an error (in Supabase edge function, which we use for our backend):

"error":{"code":"Invalid input","status":422,"message":"invalid input error","details":[{"type":"Invalid Input","msg":"input_image is a not valid base64 encoded image."}]}}
Please check this guide to understand why this error code might have been returned 
https://docs.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-online-endpoints#http-status-codes

I'm a bit confused, since according to Black Forest Labs, using a image URL is acceptable. Is there a way to use an image URL in the request, or is this not possible when using Foundry? Or am I just missing something in our setup?

Thank you very much.

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


1 answer

Sort by: Most helpful
  1. AI answer

    2026-04-15T04:57:32.4733333+00:00

    Foundry exposes FLUX models through a provider-specific BFL API endpoint, but the behavior is constrained by how the model is integrated into Azure. In the provided documentation, input_image is only explicitly described for FLUX.1 Kontext [pro] in the provider-specific API, and it is documented as an image input (with parameters like input_image, aspect_ratio, etc.), not as a URL string.

    For FLUX.2 models in Foundry (including FLUX.2-pro):

    • The BFL provider-specific API is the supported route for fine-grained control.
    • The documentation calls out that these models accept text and image input and that multi-reference image editing uses base64-encoded images passed alongside the prompt.
    • The error returned by the Foundry endpoint ("input_image is a not valid base64 encoded image") indicates that the Foundry-hosted FLUX.2-pro endpoint expects input_image to be a valid base64-encoded image payload, not a URL.

    Because of this, using a direct image URL for input_image is not supported on the Foundry-hosted FLUX.2-pro endpoint. The integration requires base64-encoded image data in the request body.

    To make the request succeed against the Foundry FLUX.2-pro endpoint:

    1. Fetch the image in the backend (for example, in the Supabase edge function).
    2. Convert the binary image data to a base64 string.
    3. Pass that base64 string as the input_image (or reference image field) in the JSON payload to the Foundry BFL endpoint.

    If multiple reference images are needed, follow the documented multi-reference pattern for FLUX.2 models (up to eight reference images for FLUX.2-pro), each provided as base64-encoded image data.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.