Model IDDocumentation Index
Fetch the complete documentation index at: https://docs.gmicloud.ai/llms.txt
Use this file to discover all available pages before exploring further.
gpt-image-2 API Usage Guide
Overview
gpt-image-2 is OpenAI’s latest image generation model. It excels at following complex prompts, rendering accurate text within images, and producing photorealistic outputs across a wide range of styles. Requests are synchronous and return results immediately.Authentication
All API requests require authentication using an API key. Include your API key in the Authorization header:Submit Image Generation Request
Base URL
Endpoint
Request Format
Request Parameters
| Parameter | Type | Required | Description | Default | Constraints |
|---|---|---|---|---|---|
model | string | Yes | Model identifier | - | Must be "gpt-image-2" |
payload.prompt | string | Yes | Text description of the image to generate | - | - |
payload.size | string (enum) | No | Dimensions of the generated image | "1024x1024" | "1024x1024", "1024x1536", "1536x1024" |
payload.quality | string (enum) | No | Image quality level, affects detail and cost | "medium" | "low", "medium", "high", "auto" |
payload.n | integer | No | Number of images to generate | 1 | Min: 1, Max: 10 |
payload.output_format | string (enum) | No | File format of the generated image | "png" | "png", "jpeg" |
payload.image | string | No | Base64-encoded image to edit. Required when using image editing mode. | - | - |
payload.mask | string | No | Base64-encoded mask for inpainting. White pixels are edited, black pixels are preserved. | - | - |
Response
Request Status Values
| Status | Description |
|---|---|
queued | Request is waiting to be processed |
success | Image generation completed successfully |
failed | Image generation failed |