curl --request POST \
--url https://api.tikway.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"quality": "high",
"output_format": "png",
"images": [
{
"image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658"
}
]
}
'import requests
url = "https://api.tikway.ai/v1/images/edits"
payload = {
"model": "gpt-image-2",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"quality": "high",
"output_format": "png",
"images": [{ "image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658" }]
}
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: 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
size: '1024x1024',
quality: 'high',
output_format: 'png',
images: [
{
image_url: 'https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658'
}
]
})
};
fetch('https://api.tikway.ai/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.tikway.ai/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' => 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
'size' => '1024x1024',
'quality' => 'high',
'output_format' => 'png',
'images' => [
[
'image_url' => 'https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658'
]
]
]),
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.tikway.ai/v1/images/edits"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\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.tikway.ai/v1/images/edits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/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\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Picture editing
The gateway requires model, images and prompt to be passed in explicitly. GPT Image accepts up to 16 reference images; dall-e-2 only accepts a single PNG input; dall-e-3 does not support editing.
GPT Image 2/2.5 supports any compliance WIDTHxHEIGHT, other GPT Images use the standard three sizes. input_fidelity, background, moderation, output_format, output_compression, stream and partial_images are only used for GPT Image series.
curl --request POST \
--url https://api.tikway.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"quality": "high",
"output_format": "png",
"images": [
{
"image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658"
}
]
}
'import requests
url = "https://api.tikway.ai/v1/images/edits"
payload = {
"model": "gpt-image-2",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"quality": "high",
"output_format": "png",
"images": [{ "image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658" }]
}
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: 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
size: '1024x1024',
quality: 'high',
output_format: 'png',
images: [
{
image_url: 'https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658'
}
]
})
};
fetch('https://api.tikway.ai/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.tikway.ai/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' => 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
'size' => '1024x1024',
'quality' => 'high',
'output_format' => 'png',
'images' => [
[
'image_url' => 'https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658'
]
]
]),
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.tikway.ai/v1/images/edits"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\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.tikway.ai/v1/images/edits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/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\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\",\n \"images\": [\n {\n \"image_url\": \"https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Required. List of source images to be edited. The maximum number of GPT Image models is 16; each item must provide one of file_id or image_url. If uploading files directly, use the multipart field image[] (or images defined by your gateway).
1 - 16 elementsRequired. Text description of how you wish to edit or expand the image.
1Required. Mockup for picture editing. dall-e-3 does not support image editing.
gpt-image-2.5-sunburst, gpt-image-2.5-sunburst-2026-09-08, gpt-image-2.5-flare, gpt-image-2.5-flare-2026-09-08, gpt-image-2, gpt-image-2-2026-04-21, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, chatgpt-image-latest, dall-e-2 Output background, only supported by GPT Image model. When transparent, output_format must be png or webp.
transparent, opaque, auto, null The degree of consistency with the original input image, only supported GPT Image models apply.
high, low, null Content moderation level, only supported by the GPT Image model.
low, auto, null The number of edited images to generate.
1 <= x <= 10Compression ratio (0–100) for jpeg or webp output, supported only by GPT Image model.
0 <= x <= 100Output image format, only supported by GPT Image model.
png, jpeg, webp, null The number of intermediate graphs generated in the streaming response.
0 <= x <= 3Output quality. GPT Image supports low/medium/high/auto; GPT Image 2.5 additionally supports xhigh/max.
low, medium, high, xhigh, max, auto, null Image size. GPT Image 2/2.5 supports WIDTHxHEIGHT: width and height are multiples of 16, ratio 1:3~3:1, up to 3840x2160; other GPT Images use auto, 1024x1024, 1536x1024 or 1024x1536; supported by dall-e-2 256x256, 512x512, 1024x1024; dall-e-3 supports 1024x1024, 1792x1024, 1024x1792.
auto, 1024x1024, 1536x1024, 1024x1536, null Whether to return intermediate and final results as an SSE event stream.
A unique identifier for the end user, used for abuse monitoring and detection.
dall-e-2 is available as url or b64_json. GPT Image model fixedly returns Base64.
b64_json, url Response
The Unix timestamp in seconds when the edit result was created.
Edited image list.
Hide child attributes
Hide child attributes
Base64 encoded image content. The GPT Image model is returned by default.
The actual revision prompt word of DALL·E 3; this editing interface usually does not return this field.
Generate image URL. DALL·E is provided when using the URL return format and is usually valid for 60 minutes.
The actual output context used.
transparent, opaque Actual output format.
png, webp, jpeg Output quality for actual use.
low, medium, high, auto The actual generated image size.
The token usage of the GPT Image model.
Hide child attributes
Hide child attributes
Enter the number of tokens for text and images.
Output the number of tokens.
The total number of input and output tokens.

