curl --request POST \
--url https://api.tikway.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.5-pro",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"images": [
{
"image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658"
}
]
}
'import requests
url = "https://api.tikway.ai/v1/images/edits"
payload = {
"model": "microsoft/mai-image-2.5-pro",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"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: 'microsoft/mai-image-2.5-pro',
prompt: 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
size: '1024x1024',
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' => 'microsoft/mai-image-2.5-pro',
'prompt' => 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
'size' => '1024x1024',
'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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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
microsoft/mai-image-2.5-pro supports single JPEG/PNG image editing. model, images and prompt are required; output is fixed to a single PNG.
curl --request POST \
--url https://api.tikway.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.5-pro",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"images": [
{
"image_url": "https://gd-hbimg.huaban.com/cb36fdfc6ee4707de3ec666d6bc202fb99d9bef326a10d-oQHn3b_fw658"
}
]
}
'import requests
url = "https://api.tikway.ai/v1/images/edits"
payload = {
"model": "microsoft/mai-image-2.5-pro",
"prompt": "Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.",
"size": "1024x1024",
"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: 'microsoft/mai-image-2.5-pro',
prompt: 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
size: '1024x1024',
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' => 'microsoft/mai-image-2.5-pro',
'prompt' => 'Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.',
'size' => '1024x1024',
'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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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\": \"microsoft/mai-image-2.5-pro\",\n \"prompt\": \"Keep the apple unchanged and replace only its background with a misty enchanted forest under soft cinematic lighting.\",\n \"size\": \"1024x1024\",\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. Forward model ID for MAI Image 2.5 Pro.
microsoft/mai-image-2.5-pro Required. Text description of how you wish to edit or expand the image.
1Compatible output sizes. The MAI native editing interface does not provide independent size parameters, and whether it takes effect depends on the OFOX upstream.
auto, 1024x1024, 1536x1024, 1024x1536, null OFOX compatible response format. MAI native output is fixed to a single PNG Base64; it is recommended to use b64_json.
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.

