generate_image
Create or edit an image from a text prompt, returning a temporary URL and a preview. Use it to turn text descriptions into visual assets or modify an existing image.
Instructions
Generate an image from a text prompt (or edit an input image). Returns the URL(s) of the generated image, valid 7 days, plus a downscaled preview of the image itself when the client can show tool-result images to you. If you cannot see the image in the result, call review_image with the returned URL to get a written critique and a revised prompt, then generate again. Roughly $0.025 per image on the default model; gpt-image-2-lite is $0.008.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Image model id, e.g. gpt-image-2, gpt-image-2-lite (cheapest), gemini-3-pro-image, gemini-2.5-flash-image, doubao-seedream-4-5-251128. | gpt-image-2 |
| prompt | Yes | Text description of the image to generate. | |
| image_url | No | Optional input image for image-to-image edits. Accepts a public https:// URL, a LOCAL FILE PATH, a localhost URL, or a data: URI — local sources are uploaded for you automatically. | |
| resolution | No | Optional resolution, e.g. 1K, 2K, 4K. | |
| aspect_ratio | No | Optional aspect ratio, e.g. 1:1, 16:9, 9:16. | |
| return_image | No | Attach a downscaled preview (max 1024px JPEG) of the result so you can look at it. Set false to save context when you only need the URL. |