Billable request: generate an image with gpt-image-2-vip
curl --request POST \
--url https://api.yingtu.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-vip",
"prompt": "A silver watch on dark stone, controlled studio light, no text."
}
'import requests
url = "https://api.yingtu.ai/v1/images/generations"
payload = {
"model": "gpt-image-2-vip",
"prompt": "A silver watch on dark stone, controlled studio light, no text."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-image-2-vip',
prompt: 'A silver watch on dark stone, controlled studio light, no text.'
})
};
fetch('https://api.yingtu.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 1788307200,
"data": [
{
"b64_json": "iVBORw0KGgo="
}
],
"usage": {
"input_tokens": 24,
"output_tokens": 1756,
"total_tokens": 1780,
"input_tokens_details": {
"text_tokens": 24,
"image_tokens": 0
},
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 1756
}
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Insufficient balance for this request",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}GPT Image 2 VIP
GPT Image 2 VIP API examples
Copy gpt-image-2-vip examples for quality-aware generation, idempotent tasks, one or multiple reference images, native result parsing, and invalid values.
POST
/
v1
/
images
/
generations
Billable request: generate an image with gpt-image-2-vip
curl --request POST \
--url https://api.yingtu.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-vip",
"prompt": "A silver watch on dark stone, controlled studio light, no text."
}
'import requests
url = "https://api.yingtu.ai/v1/images/generations"
payload = {
"model": "gpt-image-2-vip",
"prompt": "A silver watch on dark stone, controlled studio light, no text."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-image-2-vip',
prompt: 'A silver watch on dark stone, controlled studio light, no text.'
})
};
fetch('https://api.yingtu.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 1788307200,
"data": [
{
"b64_json": "iVBORw0KGgo="
}
],
"usage": {
"input_tokens": 24,
"output_tokens": 1756,
"total_tokens": 1780,
"input_tokens_details": {
"text_tokens": 24,
"image_tokens": 0
},
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 1756
}
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "Insufficient balance for this request",
"type": "new_api_error",
"param": "",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"param": "<string>",
"code": "insufficient_user_quota"
}
}Generate with a quality tier
curl 'https://api.yingtu.ai/v1/images/generations' \
-H 'Authorization: Bearer YOUR_YINGTU_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-2-vip",
"prompt": "A silver watch on dark stone, controlled studio light, no text",
"size": "1024x1024",
"quality": "medium",
"n": 1
}' | jq -er '.data[0].b64_json' | base64 --decode > watch.png
low for a smaller output budget, high for the largest documented budget, or auto to delegate the choice.
Queue a 4K landscape result
import base64
import os
import time
from pathlib import Path
import requests
headers = {
"Authorization": f"Bearer {os.environ['YINGTU_API_KEY']}",
"Idempotency-Key": "vip-landscape-001",
}
submitted = requests.post(
"https://api.yingtu.ai/v1/images/tasks",
headers=headers,
json={
"model": "gpt-image-2-vip",
"action": "generate",
"prompt": "A glass greenhouse in a snowy forest at dusk, no text",
"size": "3840x2160",
"quality": "high",
"n": 1,
},
timeout=30,
)
submitted.raise_for_status()
if submitted.status_code != 202:
raise RuntimeError(f"Expected HTTP 202, received {submitted.status_code}")
task_id = submitted.json()["task_id"]
deadline = time.monotonic() + 300
while time.monotonic() < deadline:
polled = requests.get(
f"https://api.yingtu.ai/v1/tasks/{task_id}", headers=headers, timeout=30
)
polled.raise_for_status()
task = polled.json()
if task["status"] == "completed":
items = task.get("result", {}).get("data") or []
encoded = items[0].get("b64_json") if items else None
if not encoded:
raise RuntimeError("Completed task did not include image data")
Path("greenhouse.png").write_bytes(base64.b64decode(encoded))
break
if task["status"] in {"failed", "expired"}:
raise RuntimeError(task.get("error", {}).get("message", "Task failed"))
time.sleep(3)
else:
raise TimeoutError("Task deadline exceeded")
Edit a source image
curl 'https://api.yingtu.ai/v1/images/edits' \
-H 'Authorization: Bearer YOUR_YINGTU_API_KEY' \
-F 'model=gpt-image-2-vip' \
-F 'image=@product.png;type=image/png' \
-F 'prompt=Keep the product and replace the background with pale blue' \
-F 'size=2048x2048' \
-F 'quality=high' \
-F 'n=1' > edited-response.json
jq -er '.data[0].b64_json' edited-response.json | base64 --decode > edited.png
Queue a multi-image edit
import fs from "node:fs";
const product = fs.readFileSync("product.png").toString("base64");
const scene = fs.readFileSync("scene.jpg").toString("base64");
const submitted = await fetch("https://api.yingtu.ai/v1/images/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.YINGTU_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
model: "gpt-image-2-vip",
action: "edit",
prompt: "Keep the product and replace the background with pale blue",
input_images: [
{ mime_type: "image/png", data: product },
{ mime_type: "image/jpeg", data: scene },
],
size: "2048x2048",
quality: "high",
n: 1,
}),
});
if (submitted.status !== 202) throw new Error(`Submit failed: ${submitted.status}`);
const { task_id } = await submitted.json();
console.log(task_id);
Reject unknown quality values before sending
Keep a local enum and fail before creating a billable request:const qualities = new Set(["low", "medium", "high", "auto"]);
if (!qualities.has(input.quality)) throw new TypeError("Unsupported quality");
Test this model online
The embedded operation fixesgpt-image-2-vip. It defaults to 1K and low; select a larger size or quality only when the real request needs it.
Try it sends a real USD 0.05 request at the current price. Use a funded development key and keep the generated cURL private.
Authorizations
YingTu API key.
Body
application/json
Available options:
gpt-image-2-vip Example:
"gpt-image-2-vip"
Minimum string length:
1Example:
"A blue ceramic teapot on a pale table, no text"
Current public presets. Set size explicitly for predictable dimensions; the 4K landscape value is 3840x2160.
Available options:
1024x1024, 2048x2048, 3840x2160 Example:
"1024x1024"
Forwarded for both GPT Image routes. The selected upstream determines how the requested value affects the result.
Available options:
low, medium, high, auto Example:
"low"
The documented subset returns one image.
Available options:
1 Response
Complete GPT Image response
Unix timestamp in seconds.
Required array length:
1 elementShow child attributes
Show child attributes
Output size when returned by the selected GPT Image route.
Quality value reported by the selected GPT Image route.
Show child attributes
Show child attributes
Last modified on September 3, 2026