Generate image
generate_imageCreate raster images from text prompts on your ChatGPT plan with no API key. Save full-resolution files locally and get previews, transparent backgrounds, and aspect ratio control.
Instructions
Generate a new raster image (photo, illustration, texture, sprite, mockup, icon, product shot…) from a text prompt, using the user's ChatGPT plan — the same image service as OpenAI Codex's built-in image tool, no API key. Saves the full-resolution file and returns its path plus a preview. The service chooses resolution and quality; steer orientation with aspect_ratio or in the prompt. Use background="transparent" for assets that need real alpha. Typically takes 15-60 s.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of variants of this same prompt, 1-4 (default 1). Each variant is a separate request against the user's ChatGPT image quota. For several different assets make one call per asset instead. | |
| prompt | Yes | Full image description. Structure it: use case, subject, style/medium, composition, lighting, palette, exact text in quotes, constraints/avoid. | |
| overwrite | No | Replace an existing file at output_path (default false). | |
| background | No | Background: "transparent" returns a PNG with a real alpha channel (cutouts, sprites, icons, stickers, logos); "opaque" asks for a filled background (a hint — also describe the backdrop in the prompt); "auto" (default) lets the service decide. | auto |
| output_path | No | Where to save: a .png/.jpg/.jpeg file path or a directory, absolute or relative to the workspace root. Omit to save in the server's image library (outside the project). Existing files are never replaced unless overwrite=true (a -2, -3… sibling is used instead); with n>1 a -1, -2… suffix is added. | |
| aspect_ratio | No | Canvas shape: auto (default), 1:1, 4:5, 5:4, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9 or 9:21. The service chooses the exact pixel size from the prompt; this adds an explicit aspect-ratio line to it. | auto |
| output_format | No | File format: png (default) or jpeg (converted locally; cannot be transparent). Inferred from output_path's extension when given. | |
| include_preview | No | Attach a downscaled preview so you can check the result visually (default true). Set false to save tokens. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| images | Yes | Saved images (full resolution). | |
| prompt | Yes | The exact prompt sent to the image service. | |
| failures | Yes | Errors for variants that failed (partial success). | |
| warnings | Yes | ||
| elapsed_ms | Yes |