跳转到主要内容
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)
model
string
必填
gpt-image-2/text-to-image
callBackUrl
string
Webhook 回调地址。
input
object
必填
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 时数组会包含多张图。