curl --request POST \
--url https://api.mountsea.ai/openai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"user": "<string>",
"image": "<string>",
"mask": "<string>"
}
'import requests
url = "https://api.mountsea.ai/openai/v1/images/generations"
payload = {
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"user": "<string>",
"image": "<string>",
"mask": "<string>"
}
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({
prompt: '<string>',
model: 'gpt-image-2',
size: '1024x1024',
n: 1,
output_compression: 50,
response_format: 'url',
user: '<string>',
image: '<string>',
mask: '<string>'
})
};
fetch('https://api.mountsea.ai/openai/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.mountsea.ai/openai/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([
'prompt' => '<string>',
'model' => 'gpt-image-2',
'size' => '1024x1024',
'n' => 1,
'output_compression' => 50,
'response_format' => 'url',
'user' => '<string>',
'image' => '<string>',
'mask' => '<string>'
]),
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.mountsea.ai/openai/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\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.mountsea.ai/openai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/openai/v1/images/generations")
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 \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"background": "transparent",
"output_format": "png",
"quality": "low",
"size": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"image_tokens": 123,
"text_tokens": 123
},
"output_tokens": 123,
"total_tokens": 123
}
}images.generate (OpenAI Compat)
Sync generate — JSON image field routes to edit
curl --request POST \
--url https://api.mountsea.ai/openai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"user": "<string>",
"image": "<string>",
"mask": "<string>"
}
'import requests
url = "https://api.mountsea.ai/openai/v1/images/generations"
payload = {
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"user": "<string>",
"image": "<string>",
"mask": "<string>"
}
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({
prompt: '<string>',
model: 'gpt-image-2',
size: '1024x1024',
n: 1,
output_compression: 50,
response_format: 'url',
user: '<string>',
image: '<string>',
mask: '<string>'
})
};
fetch('https://api.mountsea.ai/openai/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.mountsea.ai/openai/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([
'prompt' => '<string>',
'model' => 'gpt-image-2',
'size' => '1024x1024',
'n' => 1,
'output_compression' => 50,
'response_format' => 'url',
'user' => '<string>',
'image' => '<string>',
'mask' => '<string>'
]),
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.mountsea.ai/openai/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\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.mountsea.ai/openai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/openai/v1/images/generations")
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 \"prompt\": \"<string>\",\n \"model\": \"gpt-image-2\",\n \"size\": \"1024x1024\",\n \"n\": 1,\n \"output_compression\": 50,\n \"response_format\": \"url\",\n \"user\": \"<string>\",\n \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"background": "transparent",
"output_format": "png",
"quality": "low",
"size": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"image_tokens": 123,
"text_tokens": 123
},
"output_tokens": 123,
"total_tokens": 123
}
}POST https://api.openai.com/v1/images/generations. Synchronous — image in the response.
image (URL / data URL / raw base64, string or array) sync-routes to edit. Optional mask only applies with image.gpt-image-2 (default), gpt-image-2.5-flare, gpt-image-2.5-sunburst.
response_format defaults to url (our S3). b64_json returns base64 only — never both.
See Compat overview for SDK samples, size rules, and quality.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
提示词(prompt)
模型。默认 gpt-image-2;2.5 官方名为 gpt-image-2.5-flare / gpt-image-2.5-sunburst。
gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst 尺寸 / 分辨率。可传 ImageResolution 枚举值,或自定义 WxH(如 1280x960)。自定义尺寸须满足以下约束:① 单边 ≤ 3840 px;② 宽、高均为 16 的倍数;③ 长边 : 短边 ≤ 3:1;④ 总像素 ∈ [655 360, 8 294 400]。不满足约束或渠道不支持自定义尺寸时请求将被拒绝。
auto, 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160, 2160x3840 生成数量(当前仅支持 1)
1 <= x <= 1质量等级。gpt-image-2:low/medium/high/auto;gpt-image-2.5 额外支持 xhigh/max(Firefly 渠道会落到 high)。
auto, low, medium, high, xhigh, max, standard 背景透明度
transparent, opaque, auto 输出文件格式
png, jpeg, webp JPEG / WebP 的压缩等级 0-100
0 <= x <= 100审核强度
auto, low 响应格式:url 返回图片自家 S3 URL;b64_json 返回 base64。本服务对所有渠道(含 OpenAI gpt-image-* 这种上游强制返 b64 的模型)都会按本字段严格输出,不会两个字段都返回。不传时按 url 处理。
url, b64_json 输入图保真度(gpt-image-2 新增,仅 edit 场景生效;generate 可忽略)
high, low 终端用户标识(透传给上游供滥用监控)
【本服务私有扩展,官方 SDK 不会传】输入图片(URL / data URL / 纯 base64)。提供则同步触发图编辑(image_edit),不提供则保持原文生图行为。支持单张字符串或字符串数组。
【本服务私有扩展,官方 SDK 不会传】mask 图片(URL / data URL / 纯 base64);仅在同时提供 image 时生效,透明区域将被重绘。
Response
创建时间(unix 秒)
图片列表
Show child attributes
Show child attributes
transparent, opaque png, webp, jpeg low, medium, high Show child attributes
Show child attributes