curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "一只乌鸦在霓虹街道上奔跑",
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "星空下的古老城堡",
"ratio": "16:9",
"resolution": "4k",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "水彩画风格的橘猫",
"ratio": "1:1",
"resolution": "2k",
"n": 4
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
GPT Image 2 (OpenAI)
文生图
GPT Image 2 文生图 —— 基于文本提示生成图像(OpenAI 兼容接口)
POST
/
api
/
v1
/
task
/
submit
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "一只乌鸦在霓虹街道上奔跑",
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "星空下的古老城堡",
"ratio": "16:9",
"resolution": "4k",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "水彩画风格的橘猫",
"ratio": "1:1",
"resolution": "2k",
"n": 4
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
使用 GPT Image 2 从文本生成图像。上游是同步接口;平台仍然走标准的 submit / query / webhook 异步任务流程。
总费用 =
可用模型
gpt-image-2/text-to-image
价格
按 分辨率档位 × 张数 计费,失败不扣费:resolution | 单价 / 张 |
|---|---|
1k(默认) | $0.02 |
2k | $0.04 |
4k | $0.06 |
n × 单价(resolution)。
gpt-image-2/text-to-imageWebhook 回调地址。
隐藏 properties
隐藏 properties
生成图像的文本描述。
图像宽高比。13 个可选值:
1:1 / 3:2 / 2:3 / 4:3 / 3:4 / 5:4 / 4:5 / 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21默认由上游决定。当
resolution = 4k 时,ratio 仅支持 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21。其他比例 + 4K 因总像素超上限会被拒绝。输出分辨率档位。可选
1k / 2k / 4k。1k 是默认值;不传等同 1k。ratio × resolution → 实际像素:| ratio | 1k | 2k | 4k |
|---|---|---|---|
1:1 | 1024×1024 | 2048×2048 | ❌ |
3:2 | 1536×1024 | 2048×1360 | ❌ |
2:3 | 1024×1536 | 1360×2048 | ❌ |
4:3 | 1024×768 | 2048×1536 | ❌ |
3:4 | 768×1024 | 1536×2048 | ❌ |
5:4 | 1280×1024 | 2560×2048 | ❌ |
4:5 | 1024×1280 | 2048×2560 | ❌ |
16:9 | 1536×864 | 2048×1152 | 3840×2160 |
9:16 | 864×1536 | 1152×2048 | 2160×3840 |
2:1 | 2048×1024 | 2688×1344 | 3840×1920 |
1:2 | 1024×2048 | 1344×2688 | 1920×3840 |
21:9 | 2016×864 | 2688×1152 | 3840×1648 |
9:21 | 864×2016 | 1152×2688 | 1648×3840 |
生成张数。范围
1-10,默认 1。账单按 n × 单价(resolution) 线性扣费。curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "一只乌鸦在霓虹街道上奔跑",
"ratio": "16:9",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "星空下的古老城堡",
"ratio": "16:9",
"resolution": "4k",
"n": 1
}
}'
curl --request POST \
--url https://api.maxapi.io/api/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2/text-to-image",
"callBackUrl": "https://example.com/webhook",
"input": {
"prompt": "水彩画风格的橘猫",
"ratio": "1:1",
"resolution": "2k",
"n": 4
}
}'
{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
获取结果
通过 Query Task 或 Webhook 获取结果。{
"code": 0,
"msg": "ok",
"data": {
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "SUCCESS",
"input": {
"model": "gpt-image-2/text-to-image",
"prompt": "一只乌鸦在霓虹街道上奔跑"
},
"result": {
"type": "image",
"urls": ["https://cdn.maxapi.io/images/.../image-0.png"]
}
}
}
最终
urls 为 Max API CDN 上的稳定地址,可直接访问。n > 1 时数组会包含多张图。⌘I