GPT Image 2 (Subscription)
https://sangtao.ai/api/v2/agents/jobs/createGenerate images with GPT Image 2 on your subscription — from 100₫ an image, with up to 20 reference images per request.
Asynchronous: create a job, poll until it finishes, then read the result URL. A job usually takes 30–90 seconds.
Headers
X-Api-KeystringrequiredYour API key. Create one on the API Key page in your account.
Content-Typestringrequiredapplication/json
Request
One job usually produces one image — occasionally two. For a predictable number, create one job each.
modelstringrequiredMust be "chatgpt-image-sangtao"
promptstringrequiredWhat to draw. Describe the scene, the style and the composition — one or two words is not enough. A short prompt like "blue square" comes back as PROMPT_UNCLEAR.
aspectRatiostringoptional"1:1", "16:9", "9:16"… Describing the shape inside the prompt works too, so this field is a convenience rather than the only way.
formatstringoptionaldefault "png""png" or "jpeg"
referenceImagesstring[]optionalUp to 20 links, each starting with http:// or https://. Every one must open without a login — we fetch them while creating the job and refuse it outright rather than letting the job run and fail later. Some CDNs block requests coming from another server, so a link that works in your browser can still be rejected. If the image only exists on your machine, upload it first: Image upload returns a URL you can use here.
resolutionstringoptionaldefault "1K""1K" or "2K". 2K gives a long edge of about 2048px
requireTransparentbooloptionalAsk for a transparent background
dpiintoptional1–1200. Print metadata only — does NOT change pixel size
idempotencyKeystringoptionalProtects a retry from creating a second job: calling again with the same key returns the same jobId, with nothing charged twice. Use a NEW value for every job you actually want — only the key is compared, not the prompt, so a reused one hands back the earlier image with no error. It holds for about five minutes. A UUID per job, or your own order id.
Response
jobIdstringThe job id. Pass it to GET /jobs/{jobId} to poll for the result. Store it against your own order or record — it is the only handle you have on the job afterwards.
statusstringAlways "WaitingForAgent" here — the job is queued, not running yet.
chargeSourcestring"Subscription" when a monthly plan covers it, "Credit" when it is paid from your balance.
creditCostnumberWhat this job cost. 0 when a plan covered it.
quotaRemainingnumberPlan allowance left after this job. null when credits paid.
queuePositionnumberPlace in the queue. 0 means it starts immediately.
queueDepthnumberHow many jobs the queue holds in total.
runningJobsnumberYour jobs running right now.
concurrencynumberHow many of your jobs may run at once. Extra jobs queue rather than fail.
capReasonstringWhy that concurrency figure — e.g. your plan, or machine capacity.
runningOnFallbackboolWhether a backup machine pool took the job. null in the normal case.
Errors while running
A failed job comes back with status "error" and a failureKind. This is the field that decides whether retrying is worth anything — retrying a permanent failure only burns more money.
| failureKind | Meaning | Retry? |
|---|---|---|
| PROMPT_UNCLEAR | Description too vague | No — change the prompt |
| CONTENT_REJECTED | Against the content policy | No — change the prompt |
| TRANSPARENT_CREATION_FAILED | Transparency asked for, image came back without alpha | No — be more explicit in the prompt |
| REFERENCE_DOWNLOAD_FAILED | Could not fetch a reference image | No — fix the link |
| GENERATION_TIMEOUT | Ran out of time | Yes — usually works |
| QUOTA_EXHAUSTED | Temporarily at capacity | Yes — after a few hours |
| SESSION_EXPIRED | A problem on our side, not with your request | Contact support |
| INVALID_PAYLOAD | A problem on our side | Contact support |
/agents/jobs/createcurl -X POST \
https://sangtao.ai/api/v2/agents/jobs/create \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "chatgpt-image-sangtao",
"prompt": "A vintage travel poster of Ha Long Bay at sunset",
"aspectRatio": "9:16",
"resolution": "2K"
}'{
"success": true,
"data": {
"jobId": "acff47cbfacf4e27bbc08770c9ea246d",
"status": "WaitingForAgent",
"chargeSource": "Subscription",
"creditCost": 0.0,
"quotaRemaining": 966,
"queuePosition": 0,
"queueDepth": 50,
"runningJobs": 0,
"concurrency": 10,
"capReason": "gói thuê bao",
"runningOnFallback": null
},
"error": null,
"errorCode": null
}/agents/jobs/createcurl -X POST \
https://sangtao.ai/api/v2/agents/jobs/create \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "chatgpt-image-sangtao",
"prompt": "A vintage travel poster of Ha Long Bay at sunset",
"aspectRatio": "9:16",
"resolution": "2K"
}'{
"success": true,
"data": {
"jobId": "acff47cbfacf4e27bbc08770c9ea246d",
"status": "WaitingForAgent",
"chargeSource": "Subscription",
"creditCost": 0.0,
"quotaRemaining": 966,
"queuePosition": 0,
"queueDepth": 50,
"runningJobs": 0,
"concurrency": 10,
"capReason": "gói thuê bao",
"runningOnFallback": null
},
"error": null,
"errorCode": null
}