generate_image
Generate an image from a text prompt with OpenAI GPT models. Choose from multiple model versions for speed, cost, or resolution up to 4K.
Instructions
Generate a new image from a text prompt using OpenAI GPT image models. Supports gpt-image-1, gpt-image-1.5 (4x faster/cheaper, better text), and gpt-image-2 (flexible sizes up to 4K). Automatically calculates and reports token usage and cost.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | The text prompt describing the image to generate | |
| output_path | No | Output file path (default: generated_image.png) | |
| model | No | Model to use. gpt-image-2: latest, flexible sizes up to 4K (3840/2160 experimental), no transparent_background. gpt-image-1.5: 4x faster, 20% cheaper, supports input_fidelity. gpt-image-1: original. (default: gpt-image-1) | |
| size | No | Image size. gpt-image-1/1.5 only support 1024x1024, 1024x1536, 1536x1024, auto. gpt-image-2 also supports 2K/4K presets plus custom WxH (16px multiples, each edge ≤3840, ratio ≤3:1). 3840x2160/2160x3840 are experimental. (default: auto) | |
| quality | No | Image quality level (default: auto) | |
| output_format | No | Output image format (default: png) | |
| transparent_background | No | Enable transparent background (PNG only, default: false). Not supported by gpt-image-2. | |
| moderation | No | Content moderation level (default: auto) | |
| sample_count | No | Number of images to generate (1-10, default: 1) | |
| return_base64 | No | Return base64 image data in response (default: false) | |
| include_thumbnail | No | Include thumbnail preview in MCP response for LLM recognition (default: false, overrides OPENAI_IMAGE_THUMBNAIL env var) |