Skip to content

GPT Image 2 - Image To Image ​

This page is generated from the upstream official OpenAPI documentation. Endpoints, parameters and examples match the official docs; brand and API domain are replaced with ModelFold.

Endpoint ​

POST /jobs/createTask

Full URL: https://ai.modelfold.online/v1/jobs/createTask

Authentication: every request must include the Authorization: Bearer <API_KEY> header.

Create Task ​

Use this endpoint to create a new image-to-image generation task.

  • Get Task Details — After submission, use the unified query endpoint to check task progress and retrieve results

TIP

For production use, we recommend providing the callBackUrl parameter so your service can receive completion notifications instead of polling for task status.

Request Parameters ​

Body (application/json) ​

ParameterTypeRequiredDescription
modelstringYesThe model name used for generation. This field is required. This endpoint must use the gpt-image-2-image-to-image model. Default:"gpt-image-2-image-to-image"。 Allowed values:gpt-image-2-image-to-image。 示例:gpt-image-2-image-to-image。
callBackUrlstringNoCallback URL for task completion notifications. Optional parameter. If provided, the system will send a POST request to this URL when the task completes, whether it succeeds or fails. If omitted, no callback notification will be sent. To ensure callback security, see Webhook Verification Guide. 示例:https://your-domain.com/api/callback。
inputobjectYesInput parameters for the image-to-image task.
  input.promptstringYesText prompts, up to 20,000 characters. 示例:Transform this product image into a premium e-commerce poster style.。
  input.input_urlsarray&lt;string&gt;NoArray of input image URLs.
  input.aspect_ratiostringNoThe aspect ratio of the generated image is set to auto by default.
Note: for 2K resolution, the following aspect ratios are not supported: 5:4, 4:5, 3:1, 1:3, and 9:21.
for 4K resolution, the following aspect ratios are not supported: 3:1, 1:3, and 9:21. Allowed values:auto / 1:1 / 3:2 / 2:3 / 4:3 / 3:4 / 5:4 / 4:5 / 16:9 / 9:16 / 2:1 / 1:2 / 3:1 / 1:3 / 21:9 / 9:21。 示例:auto。
  input.resolutionstringNoOutput resolution: 1K, 2K or 4K. Set this field explicitly. 2K does not support 5:4, 4:5, 3:1, 1:3 or 9:21; 4K does not support 3:1, 1:3 or 9:21. The background parameter is only available at 1K. Allowed values:1K / 2K / 4K。 示例:1K。
  input.backgroundstringNoImage background
Note: This parameter is only supported when the resolution is 1K. Allowed values:transparent / opaque / auto。 示例:transparent。

Request Example ​

bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-image-2-image-to-image",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "take a photo with Sam Altman in the conference room",
    "input_urls": [
      "https://static.aiquickdraw.com/tools/example/1776782793756_wrogXTdd.png"
    ],
    "aspect_ratio": "auto"
  }
}'
json
{
  "model": "gpt-image-2-image-to-image",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "take a photo with Sam Altman in the conference room",
    "input_urls": [
      "https://static.aiquickdraw.com/tools/example/1776782793756_wrogXTdd.png"
    ],
    "aspect_ratio": "auto"
  }
}

Response ​

200 — Request successful ​

参数类型必填说明
codeinteger否Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). 可选值:200 / 401 / 402 / 404 / 422 / 429 / 433 / 455 / 500 / 501 / 505。 示例:200。
msgstring否Response message, error description upon failure 示例:success。
dataobject是—
  data.taskIdstring是The task ID can be used with the "Get Task Details" endpoint to query the task status. 示例:dc1928bfcbc77cb6c85f3359a9c718b3。
json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_gptimage_1765180586443"
  }
}

Callback ​

onImageGenerated ​

Callback URL: {$request.body#/callBackUrl} (the callBackUrl in the request body).

Sent when the task succeeds or fails.

Callback body parameters

参数类型必填说明
codeinteger否200: success. 501: failure; see data.failCode and data.failMsg. Allowed values:200 / 501。 示例:200。
msgstring否Status message 示例:Playground task completed successfully.。
dataobject否—
  data.completeTimeinteger否Task completion time, represented as a Unix timestamp in milliseconds 示例:1786433042000。
  data.costTimeinteger否Processing time in seconds. Present on both success and failure callbacks. 示例:78。
  data.createTimeinteger否Task creation time, represented as a Unix timestamp in milliseconds 示例:1786432963000。
  data.creditsConsumednumber否Credits consumed by the task; 0 for failed tasks. 示例:3。
  data.modelstring否Image editing model used for the task 示例:gpt-image-2-image-to-image。
  data.paramstring否Parameters submitted when creating the task, in JSON string format 示例:{"input":"{\"aspect_ratio\":\"auto\",\"prompt\":\"take a photo with Sam Altman in the conference room\",\"input_urls\":[\"https://static.aiquickdraw.com/tools/example/1776782793756_wrogXTdd.png\"]}","callBackUrl":"https://your-domain.com/api/callback","model":"gpt-image-2-image-to-image"}。
  data.resultJsonstring否Image generation result in JSON string format. resultUrls contains the list of generated image URLs. Present only when state is success. 示例:{"resultUrls":["https://tempfile.aiquickdraw.com/images/chatgpt/file_000000008b8481f7a0a8618ee2d10b84.png"]}。
  data.statestring否Task status Allowed values:success / fail。 示例:success。
  data.taskIdstring否Task ID 示例:3fd37da5c726d0c8b1278f391906ac82。
  data.updateTimeinteger否Use completeTime as the completion time; updateTime may equal createTime. 示例:1786433042000。
  data.failCodestring否Failure code, a numeric string such as "400" or "500". Present only when state is fail. 示例:500。
  data.failMsgstring否Failure reason. Present only when state is fail. 示例:&lt;error detail&gt;。

Success

json
{
  "code": 200,
  "msg": "Playground task completed successfully.",
  "data": {
    "taskId": "3fd37da5c726d0c8b1278f391906ac82",
    "model": "gpt-image-2-image-to-image",
    "state": "success",
    "param": "{\"input\":\"{\\\"aspect_ratio\\\":\\\"auto\\\",\\\"prompt\\\":\\\"take a photo with Sam Altman in the conference room\\\",\\\"input_urls\\\":[\\\"https://static.aiquickdraw.com/tools/example/1776782793756_wrogXTdd.png\\\"]}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"gpt-image-2-image-to-image\"}",
    "resultJson": "{\"resultUrls\":[\"https://tempfile.aiquickdraw.com/images/chatgpt/file_000000008b8481f7a0a8618ee2d10b84.png\"]}",
    "completeTime": 1786433042000,
    "createTime": 1786432963000,
    "costTime": 78,
    "creditsConsumed": 3,
    "updateTime": 1786433042000
  }
}

Failure

json
{
  "code": 501,
  "msg": "Playground task failed.",
  "data": {
    "taskId": "3fd37da5c726d0c8b1278f391906ac82",
    "model": "gpt-image-2-image-to-image",
    "state": "fail",
    "param": "{\"input\":\"{\\\"aspect_ratio\\\":\\\"auto\\\",\\\"prompt\\\":\\\"take a photo with Sam Altman in the conference room\\\",\\\"input_urls\\\":[\\\"https://static.aiquickdraw.com/tools/example/1776782793756_wrogXTdd.png\\\"]}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"gpt-image-2-image-to-image\"}",
    "failCode": "500",
    "failMsg": "<error detail>",
    "completeTime": 1786433042000,
    "createTime": 1786432963000,
    "costTime": 78,
    "creditsConsumed": 0,
    "updateTime": 1786433042000
  }
}

ModelFold — one API for all the best AI models.