Skip to main content
Use image generation within a Response when the model should generate an image as part of the interaction. For a direct prompt-to-image request, use the standalone Images API.

Generate images

Use the image_generation tool to create images from text prompts. The model interprets your message, generates a prompt for the image model, and returns the result.

Image generation models

Image generation options

The response includes an image_generation_call item with the generated image URL and the revised prompt used by the image model:
The result field contains a URL to the generated image. The revised_prompt shows the expanded prompt the image model used — the LLM enhances your brief instruction into a detailed image description.

Force image generation

Use tool_choice to ensure the model generates an image rather than responding with text only.

Image output structure

The response output array contains these items when an image is generated:
  1. function_call — the model’s call to the image generation tool with the refined prompt
  2. image_generation_call — the generation result with status: "completed" and result (image URL)
  3. function_call_output — the raw tool output containing the URL
  4. message — the model’s text response describing or referencing the image
Image URLs expire after 1 hour. Download or cache them if you need long-term access.