OpenAI
OpenAI Image Edit
Creates an edited or extended image given one or more source images and a prompt.
v1/images/editsAuthorizations
Use the following format for authentication: Bearer sk-pat-YourAccessToken
The key value is your HAI Gateway Personal Access Token (starting with sk-pat-). No separate API key from OpenAI is required.
Base URL
Body Parameters
Content-Type: multipart/form-data
Image model, e.g. gpt-image-2
Reference image file(s). For multiple images, repeat the image[] field; GPT image series accepts up to 16 per request
Edit description
Mask image (requires alpha channel) specifying the area to edit
Number of images to generate, default 1, range 1–10
auto / 1024x1024 / 1536x1024 / 1024x1536
low / medium / high / auto
Background mode: transparent / opaque / auto, default auto, GPT image series only
Image encoding format: png / jpeg / webp, default png, GPT image series only
Whether to enable streaming (partial images), default false, GPT image series only
For full parameter descriptions, refer to the OpenAI official documentation.
curl https://api.hai.network/openai/v1/images/edits \
-H "Authorization: Bearer sk-pat-YourAccessToken" \
-F "model=gpt-image-2" \
-F "image[]=@body-lotion.png" \
-F "image[]=@bath-bomb.png" \
-F "image[]=@incense-kit.png" \
-F "image[]=@soap.png" \
-F "prompt=Create a lovely gift basket with these four items in it"{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}