create_image
Generate or edit images from natural language prompts, supporting style transfer, background control, masks, and saving to files.
Instructions
Generate or edit images using OpenAI GPT Image. Use when asked to 'create an image', 'generate a picture', 'draw', 'make an illustration', 'edit an image', 'transform a photo', or any visual content creation request. Supports image input for editing and style transfer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mask | No | File path to a PNG image with an alpha channel to use as a mask for targeted inpainting. Transparent areas of the mask indicate where the image should be edited. Only used with the edit endpoint (when input_images is provided). | |
| size | No | Size of the generated image. '1024x1024' for square, '1024x1536' for portrait, '1536x1024' for landscape, or 'auto' to let the model decide. | 1024x1024 |
| style | No | Optional style preset that guides image generation towards a specific visual style. | |
| prompt | Yes | A detailed description of the image to generate, or editing instructions when input images are provided. Be specific about style, composition, colors, mood, and subject matter for best results. | |
| quality | No | Quality of the generated image. 'high' produces the most detailed output, 'medium' balances quality and speed, 'low' is fastest, 'auto' lets the model decide. | auto |
| background | No | Background style for the generated image. 'transparent' generates images with a transparent background (requires PNG or WebP output), 'opaque' forces a solid background, 'auto' lets the model decide. | auto |
| output_file | Yes | File path to save the generated image. Supports both absolute paths (/Users/name/image.png) and relative paths (./output/image.png). The image will be written to this path and the path returned in the response. | |
| input_images | No | File paths to input images for editing or style reference. Supports PNG, JPEG, WebP, and GIF formats. Max 20MB per image. When provided, the prompt should describe how to modify or use these images. Accepts a single path string, a JSON-encoded array string, or an array of strings. | |
| input_fidelity | No | Controls how strictly the output image preserves the original input image details. 'high' preserves more details, 'low' allows more creative freedom. Only used with the edit endpoint (when input_images is provided). | |
| number_of_images | No | Number of image variations to generate (1-4). Multiple images are saved with numbered filenames (e.g., output_1.png, output_2.png). | |
| output_mime_type | No | Output image format. 'image/png' supports transparency, 'image/jpeg' for smaller file sizes, 'image/webp' for modern web use. | image/png |
| system_message_file | No | File path to a text file containing system-level instructions. The file contents are prepended to the prompt (truncated to 4000 chars). Use for persistent style guidelines, brand constraints, or negative constraints. Since the OpenAI images API does not support a native system role, the content is prepended to the prompt. |