curl --request POST \
--url https://api.goenhance.ai/api/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "mai-image-2-7",
"prompt": "A minimalist product photograph of a perfume bottle on white marble, soft side lighting",
"ratio": "1:1",
"image_size": "1K"
}
'import requests
url = "https://api.goenhance.ai/api/v1/images/generations"
payload = {
"model": "mai-image-2-7",
"prompt": "A minimalist product photograph of a perfume bottle on white marble, soft side lighting",
"ratio": "1:1",
"image_size": "1K"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'mai-image-2-7',
prompt: 'A minimalist product photograph of a perfume bottle on white marble, soft side lighting',
ratio: '1:1',
image_size: '1K'
})
};
fetch('https://api.goenhance.ai/api/v1/images/generations', 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.goenhance.ai/api/v1/images/generations",
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' => 'mai-image-2-7',
'prompt' => 'A minimalist product photograph of a perfume bottle on white marble, soft side lighting',
'ratio' => '1:1',
'image_size' => '1K'
]),
CURLOPT_HTTPHEADER => [
"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.goenhance.ai/api/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.goenhance.ai/api/v1/images/generations")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5",
"cost": 2.56
}
}MAI Image 2.7
Microsoft MAI Image 2.7: high-quality image generation, single-image editing, and multi-image composition.
Generate one PNG up to 2048×2048 (4,194,304 pixels), or edit and compose with up to 5 reference images. Defaults: 1K and 1:1. For text-to-image, choose ratio + image_size (1K or 2K) or specify exact width and height. For image-to-image (image_list provided), output dimensions are decided by the model from the reference images.
Pricing
The table below includes one text-to-image output and up to 1,024 UTF-8 bytes of prompt text, with no reference images. Prices are in platform tokens (USD shown in parentheses).
| Ratio | 1K Output Size | 1K Price | 2K Output Size | 2K Price |
|---|---|---|---|---|
| 1:1 | 1024×1024 | 2.56 ($0.0512) | 2048×2048 | 9.25 ($0.1850) |
| 4:3 / 3:4 | 1152×864 / 864×1152 | 2.45 ($0.0490) | 2336×1760 / 1760×2336 | 9.07 ($0.1814) |
| 3:2 / 2:3 | 1248×832 / 832×1248 | 2.54 ($0.0508) | 2496×1664 / 1664×2496 | 9.16 ($0.1832) |
| 16:9 / 9:16 | 1344×768 / 768×1344 | 2.53 ($0.0506) | 2720×1536 / 1536×2720 | 9.21 ($0.1842) |
| 2:1 / 1:2 | 1536×768 / 768×1536 | 2.84 ($0.0568) | 2880×1440 / 1440×2880 | 9.15 ($0.1830) |
| 21:9 / 9:21 | 1792×768 / 768×1792 | 3.26 ($0.0652) | 3104×1312 / 1312×3104 | 8.99 ($0.1798) |
| 4:1 / 1:4 | 3072×768 / 768×3072 | 5.35 ($0.1070) | 4096×1024 / 1024×4096 | 9.25 ($0.1850) |
- Exact
width×heighttext-to-image outputs are priced proportionally by total pixel count up to 4,194,304 pixels. - Each additional started 1,024 bytes of trimmed UTF-8 prompt text adds 0.33 tokens ($0.0066).
- Image-to-image / editing (
image_listprovided): because the model determines output dimensions from the reference images, the output component is billed at the 2K ceiling of 8.92 tokens ($0.1784). - Each reference image adds 0.53 tokens ($0.0106) per started 1,048,576 pixels. Round each image up separately, then sum.
- Example: editing with a short prompt and one 1024×1024 reference image costs 9.78 tokens ($0.1956).
Use POST /api/v1/pricing/quote with the same prompt, ratio, image_size (or width/height), and image_list for an exact quote before submitting. Group discounts, if any, apply to the total. Failed jobs refund their charge.
This endpoint outputs one PNG per request. 4K, ratio: "auto", transparent background, and multiple outputs (n > 1) are not supported.
Returns an img_uuid; poll GET /api/v1/jobs/detail or use custom_callback_url.
curl --request POST \
--url https://api.goenhance.ai/api/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "mai-image-2-7",
"prompt": "A minimalist product photograph of a perfume bottle on white marble, soft side lighting",
"ratio": "1:1",
"image_size": "1K"
}
'import requests
url = "https://api.goenhance.ai/api/v1/images/generations"
payload = {
"model": "mai-image-2-7",
"prompt": "A minimalist product photograph of a perfume bottle on white marble, soft side lighting",
"ratio": "1:1",
"image_size": "1K"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'mai-image-2-7',
prompt: 'A minimalist product photograph of a perfume bottle on white marble, soft side lighting',
ratio: '1:1',
image_size: '1K'
})
};
fetch('https://api.goenhance.ai/api/v1/images/generations', 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.goenhance.ai/api/v1/images/generations",
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' => 'mai-image-2-7',
'prompt' => 'A minimalist product photograph of a perfume bottle on white marble, soft side lighting',
'ratio' => '1:1',
'image_size' => '1K'
]),
CURLOPT_HTTPHEADER => [
"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.goenhance.ai/api/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.goenhance.ai/api/v1/images/generations")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"mai-image-2-7\",\n \"prompt\": \"A minimalist product photograph of a perfume bottle on white marble, soft side lighting\",\n \"ratio\": \"1:1\",\n \"image_size\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5",
"cost": 2.56
}
}Body
Optional. A publicly accessible HTTPS URL. When the task status changes (processing / success / failed), GoEnhance sends a POST request to this URL. The request body is identical to the response of GET /api/v1/jobs/detail. If your server does not respond with HTTP 200, the notification is retried up to 3 times, with a 3-second timeout per attempt.
"https://your-server.com/goenhance/callback"
