curl --request POST \
--url https://api.upmore.net/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "gpt-image-2",
"prompt": "Turn the fox's fur bright blue and add falling snowflakes",
"images": [
{
"image_url": "https://your-bucket.tos-cn-beijing.volces.com/fox.png",
"file_id": "<string>"
}
],
"mask": {
"image_url": "<string>"
},
"n": 1,
"size": "1024x1024",
"quality": "low",
"background": "opaque",
"output_format": "png",
"output_compression": 50,
"moderation": "auto",
"stream": false,
"partial_images": 123
}
EOFimport requests
url = "https://api.upmore.net/v1/images/edits"
payload = {
"model": "gpt-image-2",
"prompt": "Turn the fox's fur bright blue and add falling snowflakes",
"images": [
{
"image_url": "https://your-bucket.tos-cn-beijing.volces.com/fox.png",
"file_id": "<string>"
}
],
"mask": { "image_url": "<string>" },
"n": 1,
"size": "1024x1024",
"quality": "low",
"background": "opaque",
"output_format": "png",
"output_compression": 50,
"moderation": "auto",
"stream": False,
"partial_images": 123
}
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',
prompt: 'Turn the fox\'s fur bright blue and add falling snowflakes',
images: [
{
image_url: 'https://your-bucket.tos-cn-beijing.volces.com/fox.png',
file_id: '<string>'
}
],
mask: {image_url: '<string>'},
n: 1,
size: '1024x1024',
quality: 'low',
background: 'opaque',
output_format: 'png',
output_compression: 50,
moderation: 'auto',
stream: false,
partial_images: 123
})
};
fetch('https://api.upmore.net/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upmore.net/v1/images/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-image-2',
'prompt' => 'Turn the fox\'s fur bright blue and add falling snowflakes',
'images' => [
[
'image_url' => 'https://your-bucket.tos-cn-beijing.volces.com/fox.png',
'file_id' => '<string>'
]
],
'mask' => [
'image_url' => '<string>'
],
'n' => 1,
'size' => '1024x1024',
'quality' => 'low',
'background' => 'opaque',
'output_format' => 'png',
'output_compression' => 50,
'moderation' => 'auto',
'stream' => false,
'partial_images' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upmore.net/v1/images/edits"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.upmore.net/v1/images/edits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upmore.net/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"background": "<string>",
"output_format": "<string>",
"quality": "<string>",
"size": "<string>",
"data": [
{
"b64_json": "<string>"
}
],
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"image_tokens": 123,
"text_tokens": 123
},
"output_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}gpt-image-2 · Image-to-image
Edits an existing image with a text prompt, optionally guided by additional reference images and a mask. Send as multipart/form-data.
curl --request POST \
--url https://api.upmore.net/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "gpt-image-2",
"prompt": "Turn the fox's fur bright blue and add falling snowflakes",
"images": [
{
"image_url": "https://your-bucket.tos-cn-beijing.volces.com/fox.png",
"file_id": "<string>"
}
],
"mask": {
"image_url": "<string>"
},
"n": 1,
"size": "1024x1024",
"quality": "low",
"background": "opaque",
"output_format": "png",
"output_compression": 50,
"moderation": "auto",
"stream": false,
"partial_images": 123
}
EOFimport requests
url = "https://api.upmore.net/v1/images/edits"
payload = {
"model": "gpt-image-2",
"prompt": "Turn the fox's fur bright blue and add falling snowflakes",
"images": [
{
"image_url": "https://your-bucket.tos-cn-beijing.volces.com/fox.png",
"file_id": "<string>"
}
],
"mask": { "image_url": "<string>" },
"n": 1,
"size": "1024x1024",
"quality": "low",
"background": "opaque",
"output_format": "png",
"output_compression": 50,
"moderation": "auto",
"stream": False,
"partial_images": 123
}
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',
prompt: 'Turn the fox\'s fur bright blue and add falling snowflakes',
images: [
{
image_url: 'https://your-bucket.tos-cn-beijing.volces.com/fox.png',
file_id: '<string>'
}
],
mask: {image_url: '<string>'},
n: 1,
size: '1024x1024',
quality: 'low',
background: 'opaque',
output_format: 'png',
output_compression: 50,
moderation: 'auto',
stream: false,
partial_images: 123
})
};
fetch('https://api.upmore.net/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upmore.net/v1/images/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gpt-image-2',
'prompt' => 'Turn the fox\'s fur bright blue and add falling snowflakes',
'images' => [
[
'image_url' => 'https://your-bucket.tos-cn-beijing.volces.com/fox.png',
'file_id' => '<string>'
]
],
'mask' => [
'image_url' => '<string>'
],
'n' => 1,
'size' => '1024x1024',
'quality' => 'low',
'background' => 'opaque',
'output_format' => 'png',
'output_compression' => 50,
'moderation' => 'auto',
'stream' => false,
'partial_images' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upmore.net/v1/images/edits"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.upmore.net/v1/images/edits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upmore.net/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Turn the fox's fur bright blue and add falling snowflakes\",\n \"images\": [\n {\n \"image_url\": \"https://your-bucket.tos-cn-beijing.volces.com/fox.png\",\n \"file_id\": \"<string>\"\n }\n ],\n \"mask\": {\n \"image_url\": \"<string>\"\n },\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"low\",\n \"background\": \"opaque\",\n \"output_format\": \"png\",\n \"output_compression\": 50,\n \"moderation\": \"auto\",\n \"stream\": false,\n \"partial_images\": 123\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"background": "<string>",
"output_format": "<string>",
"quality": "<string>",
"size": "<string>",
"data": [
{
"b64_json": "<string>"
}
],
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"image_tokens": 123,
"text_tokens": 123
},
"output_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Must be gpt-image-2.
gpt-image-2 "gpt-image-2"
Text description of the desired edit.
"Turn the fox's fur bright blue and add falling snowflakes"
Source images to edit. Use this JSON form to pass images by URL instead of uploading files.
1 - 16 elementsShow child attributes
Show child attributes
Editable region. Must be a PNG with an alpha channel the same size as the source image.
Show child attributes
Show child attributes
Number of images to generate.
1 <= x <= 10{width}x{height}. Edges must be multiples of 16, aspect ratio <= 3:1, total pixels 655,360-8,294,400, max edge 3,840px. Omit to let the model choose (~1.3M pixels).
"1024x1024"
Rendering quality.
low, medium, high, auto Background treatment.
opaque, transparent, auto Output image format.
png, jpeg Compression level for jpeg output.
0 <= x <= 100Content moderation strictness.
auto, low Stream partial images as server-sent events.
Number of preview frames to request when stream is true.
Response
Image edited successfully