Generate

GPT Image 2 and 2.5

Generate and edit images with GPT Image 2, 2.5 Sunburst, and 2.5 Flare.

Use GPT-Image-2, GPT-Image-2.5-Sunburst or GPT-Image-2.5-Flare for text-to-image and image editing. Existing -azure model IDs remain accepted as aliases of the matching model. Check the models available to your account in the model catalog.

SettingMachGen /api/v0/generate/openai/v1/images/generations and /images/edits
Sizeimage_config: {"width": 1536, "height": 864} or {"size_mode": "auto"}size: "1536x864" or "auto"
Render optionsInside image_outputTop-level fields
Edit referencessrc_image_urls or src_task_idsMultipart image[] or JSON images
Mask or markupsrc_mask_url or src_markup_urlmask or markup
Previewsimage_output.partial_images; read via task statusstream: true and partial_images: 0..3
Number of outputsOne per taskn: 1..10
Reduced moderationmoderate: falsemoderation: "low"
Safety identifiersafety_identifiersafety_identifier (preferred) or legacy user

Dimensions must be multiples of 16. Neither edge can exceed 3840 pixels, and the output must have 655,360-8,294,400 pixels and an aspect ratio between 1:3 and 3:1. For a custom size such as 1024x656, send the dimensions without an aspect_ratio in native requests. The existing presets keep their prices. Custom dimensions use the smallest preset that covers their pixel count. Explicit auto bills at the 2160x3840 preset rate regardless of the delivered size. The price is per image and includes previews.

Both compatible endpoints default to 1280x1280 when size is omitted or null. Generations require model. Edits default to gpt-image-2.5-sunburst when model is omitted. A null model is invalid.

  • quality: auto, low, medium or high. The 2.5 models also accept xhigh and max. In the compatible API quality defaults to auto. Native requests without quality keep their model default: high for GPT Image 2 STANDARD, low for EXPRESS, and max for 2.5.
  • background: auto, opaque or transparent. Transparency requires PNG or WebP. GPT Image 2 transparent output is subject to upstream preview access.
  • output_format: png (default), jpeg or webp. output_compression is an integer from 0 to 100 for JPEG or WebP.
  • partial_images: request up to three previews. The provider can deliver fewer. With compatible streaming and zero previews, only the completed image is sent.

The compatible API includes provider-reported quality and background on completed images. Streaming completion events use the request settings when the provider omits them. For non-streaming batches, a field is included only when every image has the same reported value.

Use 1-16 ordered reference images. JSON references take image_url (HTTP(S) or a base64 image data URL) or file_id (the artifact_path from your MachGen upload). Files uploaded to OpenAI cannot be read by MachGen. Masks are PNG images with an alpha channel and must match the first reference. For 2.5, use a transparent PNG markup layer to guide the edit. You can supply either a mask or markup. Prompts can contain up to 32,000 characters.

Reduced moderation requires account permission. Use a pseudonymous safety_identifier of at most 128 characters; when only legacy user is sent, the compatible API hashes it together with your MachGen account ID before forwarding.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_MACHGEN_API_KEY",
    base_url="https://api.machgen.ai/openai/v1",
)
result = client.images.generate(
    model="gpt-image-2.5-flare",
    prompt="A red ceramic mug isolated on a transparent background",
    size="1536x864",
    quality="high",
    background="transparent",
    output_format="webp",
    n=2,
)

For complexity, SVG and GIF output, see GPT Image 2.6.