Skip to content

Google - Nano Banana 2 Lite ​

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 generation task. Provide a text prompt, and optionally include image URLs as visual references.

Output: one JPEG image per task. The output format cannot be set; do not rely on the file extension in the result URL.

  • Set image_urls to an empty array or omit it for pure text-to-image generation. Up to 10 images are supported.

  • Supported aspect ratios: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9, auto.

  • 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 nano-banana-2-lite model. Default:"nano-banana-2-lite"。 Allowed values:nano-banana-2-lite。 示例:nano-banana-2-lite。
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 generation task.
  input.image_urlsarray&lt;string&gt;NoInput image URL array. Optional parameter. Set to an empty array or omit it for pure text-to-image generation. Supports up to 10 images.
- Please provide uploaded file URLs, not raw file content
- Accepted types: image/jpeg, image/png, image/webp
- Max size: 30.0MB Default:[]。
  input.promptstringYesText prompt used to generate the image. Required. Maximum length: 20000 characters. 示例:Generate a pig on the grass, cinematic light。
  input.aspect_ratiostringYesRequired. Aspect ratio of the output image. Use "auto" to let the model decide. Allowed values:1:1 / 1:4 / 1:8 / 2:3 / 3:2 / 3:4 / 4:1 / 4:3 / 4:5 / 5:4 / 8:1 / 9:16 / 16:9 / 21:9 / auto。 示例:auto。

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": "nano-banana-2-lite",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "image_urls": [
      "https://file.aiquickdraw.com/custom-page/akr/section-images/1756223420389w8xa2jfe.png"
    ],
    "prompt": "Generate a pig on the grass, cinematic light",
    "aspect_ratio": "auto"
  }
}'
json
{
  "model": "nano-banana-2-lite",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "image_urls": [
      "https://file.aiquickdraw.com/custom-page/akr/section-images/1756223420389w8xa2jfe.png"
    ],
    "prompt": "Generate a pig on the grass, cinematic light",
    "aspect_ratio": "auto"
  }
}

Response ​

200 — Request successful ​

json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_nanobanana_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 示例:1786429387000。
  data.costTimeinteger否Processing time in seconds. Present on both success and failure callbacks. 示例:135。
  data.createTimeinteger否Task creation time, represented as a Unix timestamp in milliseconds 示例:1786429251000。
  data.creditsConsumednumber否Credits consumed by the task; 0 for failed tasks. 示例:3。
  data.modelstring否Image generation model used for the task 示例:nano-banana-2-lite。
  data.paramstring否Parameters submitted when creating the task, in JSON string format 示例:{"input":"{\"aspect_ratio\":\"auto\",\"image_urls\":[\"https://file.aiquickdraw.com/custom-page/akr/section-images/1756223420389w8xa2jfe.png\"],\"prompt\":\"Generate a pig on the grass, cinematic light\"}","callBackUrl":"https://your-domain.com/api/callback","model":"nano-banana-2-lite"}。
  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/ggc/226095d9935c83a8a0b4f0e50c235219_1786429384006.jpeg"]}。
  data.statestring否Task status Allowed values:success / fail。 示例:success。
  data.taskIdstring否Task ID 示例:226095d9935c83a8a0b4f0e50c235219。
  data.updateTimeinteger否Use completeTime as the completion time; updateTime may equal createTime. 示例:1786429387000。
  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": "226095d9935c83a8a0b4f0e50c235219",
    "model": "nano-banana-2-lite",
    "state": "success",
    "param": "{\"input\":\"{\\\"aspect_ratio\\\":\\\"auto\\\",\\\"image_urls\\\":[\\\"https://file.aiquickdraw.com/custom-page/akr/section-images/1756223420389w8xa2jfe.png\\\"],\\\"prompt\\\":\\\"Generate a pig on the grass, cinematic light\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"nano-banana-2-lite\"}",
    "resultJson": "{\"resultUrls\":[\"https://tempfile.aiquickdraw.com/ggc/226095d9935c83a8a0b4f0e50c235219_1786429384006.jpeg\"]}",
    "completeTime": 1786429387000,
    "createTime": 1786429251000,
    "costTime": 135,
    "creditsConsumed": 3,
    "updateTime": 1786429387000
  }
}

Failure

json
{
  "code": 501,
  "msg": "Playground task failed.",
  "data": {
    "taskId": "226095d9935c83a8a0b4f0e50c235219",
    "model": "nano-banana-2-lite",
    "state": "fail",
    "param": "{\"input\":\"{\\\"aspect_ratio\\\":\\\"auto\\\",\\\"image_urls\\\":[\\\"https://file.aiquickdraw.com/custom-page/akr/section-images/1756223420389w8xa2jfe.png\\\"],\\\"prompt\\\":\\\"Generate a pig on the grass, cinematic light\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"nano-banana-2-lite\"}",
    "failCode": "500",
    "failMsg": "<error detail>",
    "completeTime": 1786429387000,
    "createTime": 1786429251000,
    "costTime": 135,
    "creditsConsumed": 0,
    "updateTime": 1786429387000
  }
}

ModelFold — one API for all the best AI models.