Get Started

Generate API Key

Before using the API, you need to create an API key. Go to the API Keys page to generate your key.

Create API Keys

API Endpoints

Base URL:https://api.dh3.app
EndpointMethodDescription
/api/v1/task/createPOSTCreate / Submit a generation task
/api/v1/task/getGETQuery task status and result

Rate Limit: /api/v1/task/create has a default QPS of 3. Contact us if you need a higher rate limit.

Nano Banana Pro

Create Task

POST/api/v1/task/create

Submit a new AI image generation task

Request Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Parameters

FieldTypeRequiredDescription
modelstringYesModel name, e.g. "nano-banana-pro"
nano_banana_pro_inputobjectYesInput parameters for nano-banana-pro model
callback_urlstringNoURL to receive task result events. POST request will be sent when task completes (success/fail).

nano_banana_pro_input Parameters

FieldTypeRequiredDescription
promptstringYesText prompt, 3-20000 characters
image_urlsstring[]NoReference image URLs (0-8 images, max 30MB each)
aspect_ratiostringNo1:1 | 2:3 | 3:2 | 3:4 | 4:3 | 4:5 | 5:4 | 9:16 | 16:9 | 21:9 | auto (default: 1:1)
resolutionstringNo1K | 2K | 4K (default: 1K)
output_formatstringNopng | jpg (default: png)

Request Body Example

{
"model": "nano-banana-pro",
"nano_banana_pro_input": {
"prompt": "chinese girl with golden yellow hair is dancing, wearing black hot bikini suit, 4k",
"image_urls": [
"https://tempfile.aiquickdraw.com/workers/nano/image_1769080764854_k0gub3.jpg"
],
"aspect_ratio": "21:9",
"resolution": "1K"
},
"callback_url": "https://your-domain.ai/api/callback"
}

Response Fields

FieldTypeDescription
codeint200 = success, other values indicate failure
messagestringResponse message
task_idstringUnique task identifier for status polling

Response Example

{
"code": 200,
"message": "ok",
"task_id": "76808142f56692acea353e2d1dc90e9e"
}

Playground

Loading keys...
1import requests
2import json
3
4url = "https://api.dh3.app/api/v1/task/create"
5headers = {
6 "Authorization": "Bearer YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9data = {
10 "model": "nano-banana-pro",
11 "nano_banana_pro_input": {
12 "prompt": "A beautiful sunset over mountains, 4k, photorealistic",
13 "aspect_ratio": "1:1",
14 "resolution": "1K"
15 }
16}
17
18response = requests.post(url, headers=headers, json=data)
19result = response.json()
20print(json.dumps(result, indent=2))

Webhook Callback

Receive task completion notifications via webhook

Callback Request Parameters

FieldTypeDescription
codeint200 = success
messagestringResponse message
nano_banana_pro_outputobjectOutput object for nano-banana-pro model

nano_banana_pro_output Fields

FieldTypeDescription
task_idstringTask identifier
statusstringTask status: success | fail
imagesarrayArray of generated images (present when status is success)
err_msgstringError message (present when status is fail)

ImageFile Object

FieldTypeDescription
urlstringURL to access the generated image
content_typestringMIME type, e.g. image/png
file_namestringImage file name
file_sizestringFile size in bytes
widthstringImage width in pixels
heightstringImage height in pixels

Callback Request Example

Task Success
{
"code": 200,
"message": "Ok",
"nano_banana_pro_output": {
"task_id": "76808142f56692acea353e2d1dc90e9e",
"status": "success",
"images": [
{
"url": "https://tempfile.aiquickdraw.com/workers/nano/result.png",
"content_type": "image/png",
"file_name": "result.png",
"file_size": "2456789",
"width": "1024",
"height": "1024"
}
]
}
}
Task Failed
{
"code": 200,
"message": "Ok",
"nano_banana_pro_output": {
"task_id": "76808142f56692acea353e2d1dc90e9e",
"status": "fail",
"err_msg": "Upstream model error"
}
}

Callback Response Requirements

After receiving the callback request, the integrating service should return HTTP 200 status code upon successful processing.

Return HTTP 200

Indicates successful receipt and processing of callback content. No retry will be attempted.

Return non-200 status code

(e.g., 4xx/5xx), or server fails to respond within a reasonable time: treated as callback failure, will trigger retries.

Retry Mechanism

If the integrating service does not return HTTP 200, the system will automatically retry.

Retry Strategy
  • Maximum 3 retries (excluding the initial request)
  • If all 3 retries fail, callbacks will stop and no further attempts will be made

Notes

Callback request idempotency is the responsibility of the integrating service (e.g., check if task_id has been processed)
For complex business logic, it's recommended to return 200 quickly first, then process asynchronously to avoid duplicate callbacks due to timeout

Get Result

GET/api/v1/task/get

Get task status and result by task_id

Request Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Parameters

FieldTypeRequiredDescription
task_idstringYesTask ID returned from create endpoint

Request Body Example

{
"task_id": "76808142f56692acea353e2d1dc90e9e"
}

Response Fields

FieldTypeDescription
codeint200 = success, other values indicate failure
messagestringResponse message
nano_banana_pro_outputobjectOutput object for nano-banana-pro model

nano_banana_pro_output Fields

FieldTypeDescription
task_idstringTask identifier
statusstringTask status: queuing | processing | success | fail
imagesarrayArray of generated images (present when status is success)
err_msgstringError message (present when status is fail)

ImageFile Object

FieldTypeDescription
urlstringURL to access the generated image
content_typestringMIME type, e.g. image/png
file_namestringImage file name
file_sizestringFile size in bytes
widthstringImage width in pixels
heightstringImage height in pixels

Response Example

{
"code": 200,
"message": "Ok",
"nano_banana_pro_output": {
"task_id": "76808142f56692acea353e2d1dc90e9e",
"status": "success",
"images": [
{
"url": "https://tempfile.aiquickdraw.com/workers/nano/result.png",
"content_type": "image/png",
"file_name": "result.png",
"file_size": "2456789",
"width": "1024",
"height": "1024"
}
]
}
}

Playground

Loading keys...
1import requests
2import json
3
4url = "https://api.dh3.app/api/v1/task/get"
5headers = {
6 "Authorization": "Bearer YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9params = {"task_id": "YOUR_TASK_ID"}
10
11response = requests.get(url, headers=headers, params=params)
12result = response.json()
13print(json.dumps(result, indent=2))