# GPT Image 1.5 Image Generation

> Image Generation

Generate one or more images from a text prompt. The documented
`gpt-image-1.5` response returns base64 image data in `data[].b64_json`.

## Endpoint

`POST https://api.modelverse.cn/v1/images/generations`

## Request Body

## Responses

- **200** — Image generation response.
- **400** — Invalid request parameters or generation error.
- **default** — Error response.

## OpenAPI Definition

```json
{
  "openapi": "3.1.0",
  "x-language": "en-US",
  "info": {
    "title": "ModelVerse gpt-image-1.5 Image API",
    "version": "1.0.0",
    "description": "Self-contained OpenAPI 3.1 schema for the ModelVerse OpenAI-compatible\n`gpt-image-1.5` image generation and image editing APIs.\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint documented for this model."
    }
  ],
  "tags": [
    {
      "name": "gpt-image-1.5",
      "description": "Image generation and localized image editing with gpt-image-1.5."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/images/generations": {
      "post": {
        "tags": [
          "gpt-image-1.5"
        ],
        "operationId": "createGptImage15ImageGeneration",
        "summary": "GPT Image 1.5 Image Generation",
        "description": "Generate one or more images from a text prompt. The documented\n`gpt-image-1.5` response returns base64 image data in `data[].b64_json`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GptImage15GenerationRequest"
              },
              "examples": {
                "flowerPng": {
                  "summary": "Generate a PNG image",
                  "value": {
                    "model": "gpt-image-1.5",
                    "prompt": "a beautiful flower",
                    "size": "1024x1024",
                    "quality": "high",
                    "output_format": "png",
                    "output_compression": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image generation response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ImagesResponse"
                },
                "examples": {
                  "generatedImage": {
                    "summary": "Generated image with token usage",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "b64_json": "{image_base64_string}"
                        }
                      ],
                      "usage": {
                        "total_tokens": 4169,
                        "input_tokens": 9,
                        "output_tokens": 4160,
                        "input_tokens_details": {
                          "text_tokens": 9
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or generation error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage15Error"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage15Error"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "gpt-image-1.5"
        ],
        "operationId": "createGptImage15ImageEdit",
        "summary": "GPT Image 1.5 Image Editing",
        "description": "Edit an uploaded image with localized changes while preserving the\ncomposition, tone, and appearance of unchanged regions. The request\nuses `multipart/form-data`; `image`, `model`, and `prompt` are required,\nand `mask` is optional.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GptImage15EditRequest"
              },
              "encoding": {
                "image": {
                  "contentType": "image/png"
                },
                "mask": {
                  "contentType": "image/png"
                }
              },
              "examples": {
                "localizedEdit": {
                  "summary": "Localized edit with an optional mask",
                  "value": {
                    "image": "/path/to/your/image.png",
                    "mask": "/path/to/your/mask.png",
                    "model": "gpt-image-1.5",
                    "prompt": "Add a beach ball in the center",
                    "size": "1024x1024",
                    "n": 1,
                    "quality": "high",
                    "output_format": "png",
                    "output_compression": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image edit response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ImagesResponse"
                },
                "examples": {
                  "editedImage": {
                    "summary": "Edited image with token usage",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "b64_json": "{image_base64_string}"
                        }
                      ],
                      "usage": {
                        "total_tokens": 4169,
                        "input_tokens": 9,
                        "output_tokens": 4160,
                        "input_tokens_details": {
                          "text_tokens": 9
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or edit error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage15Error"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage15ErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage15Error"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "GptImage15Model": {
        "type": "string",
        "const": "gpt-image-1.5",
        "description": "The image model ID documented for these operations."
      },
      "GptImage15Prompt": {
        "type": "string",
        "minLength": 1,
        "description": "Text prompt describing the image to generate or the edit to apply."
      },
      "GptImage15ImageCount": {
        "type": "integer",
        "minimum": 1,
        "maximum": 4,
        "default": 1,
        "description": "Number of images to generate. The documented range is 1 to 4."
      },
      "GptImage15Size": {
        "type": "string",
        "enum": [
          "1024x1024",
          "1024x1536",
          "1536x1024"
        ],
        "default": "1024x1024",
        "description": "Image resolution supported by gpt-image-1.5."
      },
      "GptImage15Quality": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high"
        ],
        "description": "Image quality. Higher quality can take longer."
      },
      "GptImage15OutputFormat": {
        "type": "string",
        "enum": [
          "png",
          "jpeg",
          "webp"
        ],
        "default": "png",
        "description": "Output image format."
      },
      "GptImage15OutputCompression": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
        "default": 100,
        "description": "Image compression strength. `0` disables compression and `100` applies maximum compression."
      },
      "GptImage15GenerationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "$ref": "#/components/schemas/GptImage15Model"
          },
          "prompt": {
            "$ref": "#/components/schemas/GptImage15Prompt"
          },
          "n": {
            "$ref": "#/components/schemas/GptImage15ImageCount"
          },
          "size": {
            "$ref": "#/components/schemas/GptImage15Size"
          },
          "quality": {
            "$ref": "#/components/schemas/GptImage15Quality"
          },
          "output_format": {
            "$ref": "#/components/schemas/GptImage15OutputFormat"
          },
          "output_compression": {
            "$ref": "#/components/schemas/GptImage15OutputCompression"
          }
        }
      },
      "GptImage15EditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "image",
          "model",
          "prompt"
        ],
        "properties": {
          "image": {
            "type": "string",
            "format": "binary",
            "description": "Image file to edit."
          },
          "mask": {
            "type": "string",
            "format": "binary",
            "description": "Optional mask file that limits the edited region."
          },
          "model": {
            "$ref": "#/components/schemas/GptImage15Model"
          },
          "prompt": {
            "$ref": "#/components/schemas/GptImage15Prompt"
          },
          "n": {
            "$ref": "#/components/schemas/GptImage15ImageCount"
          },
          "size": {
            "$ref": "#/components/schemas/GptImage15Size"
          },
          "quality": {
            "$ref": "#/components/schemas/GptImage15Quality"
          },
          "output_format": {
            "$ref": "#/components/schemas/GptImage15OutputFormat"
          },
          "output_compression": {
            "$ref": "#/components/schemas/GptImage15OutputCompression"
          }
        }
      },
      "GptImage15ImagesResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp in seconds for when the request was created."
          },
          "data": {
            "type": "array",
            "minItems": 1,
            "description": "Generated image data. The documented gpt-image-1.5 response returns base64 image data.",
            "items": {
              "$ref": "#/components/schemas/GptImage15ImageData"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/GptImage15Usage"
          }
        }
      },
      "GptImage15ImageData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "b64_json"
        ],
        "properties": {
          "b64_json": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "Base64-encoded image data, optionally prefixed as a data URL."
          }
        }
      },
      "GptImage15Usage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "total_tokens": {
            "type": "integer",
            "description": "Total tokens used by the request."
          },
          "input_tokens": {
            "type": "integer",
            "description": "Input tokens used by the request."
          },
          "output_tokens": {
            "type": "integer",
            "description": "Output tokens used by the request."
          },
          "input_tokens_details": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "text_tokens": {
                "type": "integer",
                "description": "Text input tokens used by the request."
              }
            }
          }
        }
      },
      "GptImage15ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/GptImage15Error"
          }
        }
      },
      "GptImage15Error": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message."
          },
          "type": {
            "type": "string",
            "description": "Error type."
          },
          "param": {
            "type": [
              "string",
              "null"
            ],
            "description": "Request ID or related parameter."
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Error code."
          }
        }
      }
    },
    "examples": {
      "GptImage15Error": {
        "summary": "Documented error response",
        "value": {
          "error": {
            "message": "error_message",
            "type": "error_type",
            "param": "request_id",
            "code": "error_code"
          }
        }
      }
    }
  }
}
```
