Skip to main content
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": "A cyberpunk samurai in neon Tokyo rain",
    "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": "A cyberpunk samurai in neon Tokyo rain",
    "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": "Portrait of an astronaut drinking tea, photorealistic",
    "n": 1,
    "ratio": "1:1"
  }
}'
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
Generate images from text using xAI’s Grok Imagine. Three tiers differ in quality, batch size, and pricing. Grok Imagine is known for minimal content restrictions.

Available Models

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

Tier Comparison

Cheapest tier
  • Price: $0.001 per image
  • n range: 1-4
  • Output dimensions are inferred by Grok from the prompt content (e.g. “wide landscape” produces a landscape image; “tall portrait” produces a portrait one). Does not accept ratio / resolution parameters — describe the orientation in the prompt instead.
  • Best for: drafts, high-volume exploration
Balanced tier
  • Price: $0.0012 per image
  • n range: 1-10
Highest quality
  • Price: $0.0015 per image
  • n range: 1-10
model
string
required
One of grok-imagine/text-to-image-lite, grok-imagine/text-to-image-standard, grok-imagine/text-to-image-pro.
callBackUrl
string
Webhook callback URL.
input
object
required
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": "A cyberpunk samurai in neon Tokyo rain",
    "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": "A cyberpunk samurai in neon Tokyo rain",
    "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": "Portrait of an astronaut drinking tea, photorealistic",
    "n": 1,
    "ratio": "1:1"
  }
}'
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Query Result

Retrieve the result via the Query Task endpoint or Webhook.
{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "SUCCESS",
    "input": {
      "model": "grok-imagine/text-to-image-pro",
      "prompt": "Portrait of an astronaut drinking tea",
      "ratio": "1:1"
    },
    "result": {
      "type": "image",
      "urls": ["https://cdn.maxapi.io/images/.../image-0.jpg"]
    }
  }
}
Average generation time: 5-20 seconds. Each result URL is hosted on Max API’s CDN.