Edit one source image with GPT Image (billable)
curl --request POST \
--url https://api.yingtu.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=gpt-image-2-web \
--form 'prompt=Keep the product and replace the background with pale blue' \
--form image='@example-file'import requests
url = "https://api.yingtu.ai/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"model": "gpt-image-2-web",
"prompt": "Keep the product and replace the background with pale blue"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'gpt-image-2-web');
form.append('prompt', 'Keep the product and replace the background with pale blue');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.yingtu.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 123,
"data": [
{
"b64_json": "iVBORw0KGgo="
}
],
"size": "<string>",
"quality": "<string>",
"usage": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1,
"input_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
},
"output_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
}
}
}{
"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": "Request body exceeds the current limit",
"type": "new_api_error",
"param": "",
"code": "read_request_body_failed"
}
}{
"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 API
Edit an image with GPT Image
Inspect the synchronous GPT Image Edit operation for one multipart source image, an edit prompt, supported sizes, quality, and Base64 PNG output.
POST
/
v1
/
images
/
edits
Edit one source image with GPT Image (billable)
curl --request POST \
--url https://api.yingtu.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=gpt-image-2-web \
--form 'prompt=Keep the product and replace the background with pale blue' \
--form image='@example-file'import requests
url = "https://api.yingtu.ai/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"model": "gpt-image-2-web",
"prompt": "Keep the product and replace the background with pale blue"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'gpt-image-2-web');
form.append('prompt', 'Keep the product and replace the background with pale blue');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.yingtu.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"created": 123,
"data": [
{
"b64_json": "iVBORw0KGgo="
}
],
"size": "<string>",
"quality": "<string>",
"usage": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1,
"input_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
},
"output_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
}
}
}{
"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": "Request body exceeds the current limit",
"type": "new_api_error",
"param": "",
"code": "read_request_body_failed"
}
}{
"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"
}
}Upload one PNG, JPEG, or WebP source image with a prompt. Both reverse-image routes forward
low, medium, high, or auto; the selected upstream determines the effect.
This Images-shaped operation is synchronous. For asynchronous work with 1–16 reference images, submit JSON to /v1/images/tasks with action=edit.
Try it can create a real billable edit. Use a development image and key, and do not share authenticated generated cURL.
Authorizations
YingTu API key.
Body
multipart/form-data
Available options:
gpt-image-2-web, gpt-image-2-vip Example:
"gpt-image-2-web"
Minimum string length:
1Example:
"Keep the product and replace the background with pale blue"
One PNG, JPEG, or WebP source image.
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"
Available options:
1 Response
Complete edited 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