Endpoints
GPT Image 2 parameters
Generate an image
cURL
Python
Node.js
Edit an image
cURL
image[]:
Python
Node.js
Mask
The mask must use the same format and dimensions as the first input image and contain an alpha channel. Transparent areas identify the region to edit; GPT Image treats the mask as guidance, so the result may not follow its boundary exactly. With multiple inputs, the mask applies only to the first image.Response
Both endpoints return Base64-encoded image data and token usage. For edit requests,input_tokens_details.image_tokens includes input-image usage:
usage reports token counts, not the final billed amount. Actual charges follow the model prices, discounts, and billing records shown by ApiGo.