curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Restyle the subject in cyberpunk aesthetic",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "3:4",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Place the subject from image 1 into the scene from image 2",
"imageUrls": [
"https://example.com/subject.jpg",
"https://example.com/scene.jpg"
],
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Enhance details and upscale to 4K",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "16:9",
"resolution": "4k"
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
GPT Image 2 (OpenAI)
Image to Image
GPT Image 2 Image-to-Image — Edit images using a reference + prompt
POST
/
api
/
v1
/
task
/
submit
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Restyle the subject in cyberpunk aesthetic",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "3:4",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Place the subject from image 1 into the scene from image 2",
"imageUrls": [
"https://example.com/subject.jpg",
"https://example.com/scene.jpg"
],
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Enhance details and upscale to 4K",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "16:9",
"resolution": "4k"
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
Edit an existing image with GPT Image 2.
Total cost =
Available Model
gpt-image-2/image-to-image
Pricing
Billed per resolution tier × n. Failed tasks are not charged.resolution | Unit price |
|---|---|
1k (default) | $0.02 / image |
2k | $0.04 / image |
4k | $0.06 / image |
n × unit_price(resolution).
string
required
gpt-image-2/image-to-imagestring
Webhook callback URL.
object
required
Hide properties
Hide properties
string
required
Describe the edit to apply.
string[]
required
Array of public HTTPS URLs to reference images, up to 16. When multiple are provided, they are all used as references, in order. WebP is transcoded to JPEG automatically.
string
Output aspect ratio. 13 supported values:
1:1 / 3:2 / 2:3 / 4:3 / 3:4 / 5:4 / 4:5 / 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21Defaults to the upstream’s choice (typically follows the input image’s aspect).When
resolution = 4k, ratio must be one of 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21.string
Output resolution tier. One of
1k / 2k / 4k. Defaults to 1k.For the full ratio × resolution pixel matrix, see the text-to-image docs.integer
Number of output variants. Range
1-10. Default 1. Billed linearly: n × unit_price(resolution).curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Restyle the subject in cyberpunk aesthetic",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "3:4",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Place the subject from image 1 into the scene from image 2",
"imageUrls": [
"https://example.com/subject.jpg",
"https://example.com/scene.jpg"
],
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/image-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "Enhance details and upscale to 4K",
"imageUrls": ["https://example.com/source.jpg"],
"ratio": "16:9",
"resolution": "4k"
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
Query Result
Retrieve the result via the Query Task endpoint or Webhook.{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "SUCCESS",
"input": {
"model": "gpt-image-2/image-to-image",
"prompt": "Restyle the subject in cyberpunk aesthetic"
},
"result": {
"type": "image",
"urls": ["https://cdn.maxapi.io/images/.../image-0.png"]
}
}
}
⌘I