跳转到主要内容
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": "grok-imagine/text-to-image-lite",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "赛博朋克武士,霓虹雨夜的东京",
    "n": 2
  }
}'
curl --request POST \
  --url https://api.maxapi.io/api/v1/task/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine/text-to-image-standard",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "赛博朋克武士,霓虹雨夜的东京",
    "n": 4,
    "ratio": "16:9",
    "resolution": "720p"
  }
}'
curl --request POST \
  --url https://api.maxapi.io/api/v1/task/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine/text-to-image-pro",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "宇航员喝茶肖像,写实风格",
    "n": 1,
    "ratio": "1:1"
  }
}'
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
使用 xAI 的 Grok Imagine 从文本生成图像。提供 lite / standard / pro 三档,区别在于质量、批量上限和价格。Grok Imagine 对内容限制较少。

可用模型

grok-imagine/text-to-image-lite · grok-imagine/text-to-image-standard · grok-imagine/text-to-image-pro

档位对比

最低价
  • 价格:$0.001 / 张
  • n 范围:1-4
  • 输出尺寸由 Grok 根据 prompt 语义推断(例如写”横版风景”会出横图,“竖版肖像”会出竖图)。不接受 ratio / resolution 参数 —— 需要指定方向请在 prompt 里描述。
  • 场景:草图、大批量探索
平衡档
  • 价格:$0.0012 / 张
  • n 范围:1-10
最高质量
  • 价格:$0.0015 / 张
  • n 范围:1-10
model
string
必填
grok-imagine/text-to-image-litegrok-imagine/text-to-image-standardgrok-imagine/text-to-image-pro 之一。
callBackUrl
string
Webhook 回调 URL。
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": "grok-imagine/text-to-image-lite",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "赛博朋克武士,霓虹雨夜的东京",
    "n": 2
  }
}'
curl --request POST \
  --url https://api.maxapi.io/api/v1/task/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine/text-to-image-standard",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "赛博朋克武士,霓虹雨夜的东京",
    "n": 4,
    "ratio": "16:9",
    "resolution": "720p"
  }
}'
curl --request POST \
  --url https://api.maxapi.io/api/v1/task/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine/text-to-image-pro",
  "callBackUrl": "https://example.com/webhook",
  "input": {
    "prompt": "宇航员喝茶肖像,写实风格",
    "n": 1,
    "ratio": "1:1"
  }
}'
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

查询结果

通过 查询任务 或 Webhook 获取结果。
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "SUCCESS",
    "result": {
      "type": "image",
      "urls": ["https://cdn.maxapi.io/images/.../image-0.jpg"]
    }
  }
}
平均生成时间 5-20 秒。图片托管在 Max API 自有 CDN。