curl --request POST \
--url https://api.mountsea.ai/openai/images \
--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",
"image": "<string>",
"mask": "<string>"
}
'import requests
url = "https://api.mountsea.ai/openai/images"
payload = {
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"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',
image: '<string>',
mask: '<string>'
})
};
fetch('https://api.mountsea.ai/openai/images', 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/images",
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',
'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/images"
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 \"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/images")
.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 \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/openai/images")
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 \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}创建图像任务(异步)
文生图或编辑 — image/mask 仅 http(s) URL
curl --request POST \
--url https://api.mountsea.ai/openai/images \
--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",
"image": "<string>",
"mask": "<string>"
}
'import requests
url = "https://api.mountsea.ai/openai/images"
payload = {
"prompt": "<string>",
"model": "gpt-image-2",
"size": "1024x1024",
"n": 1,
"output_compression": 50,
"response_format": "url",
"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',
image: '<string>',
mask: '<string>'
})
};
fetch('https://api.mountsea.ai/openai/images', 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/images",
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',
'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/images"
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 \"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/images")
.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 \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/openai/images")
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 \"image\": \"<string>\",\n \"mask\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}{ "taskId": "..." }。轮询 获取任务结果。
- 不传
image→ 文生图 - 传
image→ 编辑 image+mask→ 局部重绘
image / mask 只接受 http(s):// URL。要传 base64 或 data URL,请用 兼容接口。response_format 默认 url(自家 S3)。b64_json 返回 base64。不会两个字段都给。模型:gpt-image-2(默认)、gpt-image-2.5-flare、gpt-image-2.5-sunburst。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
提示词(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 输入图片,仅接受 http(s):// URL(异步任务约束,不接 base64 / data URL)。提供则走图片编辑;不提供则走文生图。支持单张字符串或数组。如需传 base64,请改用同步接口 /openai/v1/images/generations 或 /openai/v1/images/edits。
mask 图片(仅编辑场景,仅接受 http(s):// URL);透明区域将被重绘。如需传 base64,请改用同步接口 /openai/v1/images/edits。
响应
返回 taskId
任务 ID,用于后续查询结果