Image Editing
Images must be uploaded via multipart/form-data.
/api/v1/image/generationHeader Parameters
Format: Authorization: Bearer sk-xxxxxx
Request Body
application/json
Model name, fixed value: gpt-image-1.5 gpt-image-2
"gpt-image-1.5" | "gpt-image-2"Input image URL. Input image reference for editing. For GPT image models, you can provide up to 16 images.
A text description of the desired image. The maximum length for the GPT image model is 32,000 characters.
Optional parameter: "transparent", "opaque", or "auto". When using auto, the model automatically determines the optimal background for the image. If set to transparent, the output format must support transparency, so it should be set to png (default) or webp.
Optional values are "high" or "low", controlling the fidelity to the original input image.
Input image URL. An additional image whose fully transparent areas (e.g., where alpha is zero) indicate where the image should be edited. If multiple images are provided, this mask will be applied to the first image. Must be a valid PNG file, less than 4MB in size, and have the same dimensions as the original image.
Optional parameter "low" or "auto". Used to control the content moderation level for images generated by GPT image models. The value must be low (less restrictive filtering) or auto (default).
The number of images to generate. Must be between 1 and 10. Minimum: 1. Maximum: 10.
Compression level for generated images (0-100%). This parameter is only supported by GPT image models and is only valid when the output format is webp or jpeg, with a default value of 100.
Optional parameter "png", "jpeg", or "webp". The format of the returned generated image. This parameter is only supported by GPT image models. The value must be one of png, jpeg, or webp.
quality: Optional parameter "auto", "low", "medium", or "high".
size: Optional string, or "auto", "1024x1024", "1536x1024".
A unique identifier for the end user, which helps OpenAI monitor and detect abuse.
Response Body
application/json
Success
TypeScript Definitions
Use the response body type in TypeScript.
Status Code
Data Object
Result Set
Usage Information
Number of Images
Video Seconds
Input Tokens
Total Tokens
Output Token Count
Validity Period
Task ID
Task Status
Status Information
Request ID
curl -X POST "https://api.ygw.ai/api/v1/image/generation" \ -H "Authorization: string" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-1.5" }'{
"code": 0,
"data": {
"urls": [
"string"
],
"usage": {
"images": 0,
"seconds": 0,
"input_tokens": 0,
"total_tokens": 0,
"output_tokens": 0
},
"expired": "string",
"task_id": "string",
"task_status": "string"
},
"message": "string",
"request_id": "string"
}