- The image generation tool requires the
gpt-image-1model. See the Azure OpenAI transparency note for limitations and responsible AI considerations. - You also need a compatible orchestrator model (
gpt-4o,gpt-4o-mini,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,o3, orgpt-5series) deployed in the same Foundry project.
Usage support
The following table shows SDK and setup support.Prerequisites
- An Azure account with an active subscription.
- A Foundry project.
- A basic or standard agent environment. See agent environment setup.
- Permissions to create and manage agent versions in the project.
- Two model deployments in the same Foundry project:
- A compatible Azure OpenAI model deployment for the agent (for example,
gpt-4o). - An image generation model deployment (
gpt-image-1).
- A compatible Azure OpenAI model deployment for the agent (for example,
Configure the image generation tool
- Deploy your orchestrator model (for example,
gpt-4o) to your Foundry project. - Deploy
gpt-image-1to the same Foundry project. - Confirm your region and model support for image generation. See Best practices for using tools in Microsoft Foundry Agent Service.
Code examples
Before you start, install the latest SDK package. The .NET SDK is currently in preview. For package installation instructions, see the quickstart.When to use the image generation tool
The image generation tool in Agent Service offers advantages over the Azure OpenAI Image API:Optional parameters
Customize image generation by specifying these optional parameters when you create the tool:Image generation time varies based on the
quality setting and prompt complexity. For time-sensitive applications, consider using quality: "low" or enabling partial_images for streaming.- Build conversational image experiences with GPT Image.
- Stream partial image results during generation for a smoother user experience.
Write effective text-to-image prompts
Effective prompts produce better images. Describe the subject, visual style, and composition you want. Use action words like “draw,” “create,” or “edit” to guide the model’s output. Content filtering can block image generation if the service detects unsafe content in your prompt. For more information, see Guardrails and controls overview.Verify tool execution
Use either of these approaches to confirm that image generation ran successfully:- In the response payload, look for an output item with
typeset toimage_generation_call. - In the Foundry portal, open tracing/debug for your run to confirm the tool call and inspect inputs and outputs.
image_generation_call output item with a result field containing base64-encoded image data.
If you see only text output and no image_generation_call item, the request might not be routed to image generation. Review the troubleshooting section.