MarketSupport← Back to app

Grok Imagine

Grok Imagine models are called through one unified, asynchronous job API. Start a task with POST /api/generate, then poll GET /api/generate/{taskId} until it finishes. This family exposes 7 endpoints.

Overview

Every endpoint shares the same envelope — only model and the input fields change. Run any from the Models Market playground.

Authentication

Create an API key at /api-keys, then send it as a Bearer token. Requests from the browser while logged in also work via the session cookie.

Authorization: Bearer <YOUR_API_KEY>

Create Task

POST
POST https://api.lithovas.com/api/generate

Body: { "model": "<slug>", "input": { … } }

Response: { "taskId": "<id>", "state": "waiting" }

Query Result

GET
GET https://api.lithovas.com/api/generate/<taskId>

Response: { "taskId", "state": "waiting" | "success" | "fail", "resultUrls": [ … ], "creditsConsumed", "failMsg", "balance" }

Asynchronous
A 200 from Create Task only means the task was accepted — not finished. Poll this endpoint until state becomes success or fail. Failed tasks are not billed.

Endpoints

ModelTaskmodel slug
Grok ImagineText to Imagegrok-imagine/text-to-image
Grok ImagineImage to Imagegrok-imagine/image-to-image
Grok ImagineText to Videogrok-imagine/text-to-video
Grok ImagineImage to Videogrok-imagine/image-to-video
Grok ImagineImage to Videogrok-imagine/upscale
Grok ImagineImage to Videogrok-imagine/extend
Grok Imagine 1.5 PreviewImage to Videogrok-imagine/1-5-preview

Grok Imagine · Text to Image

POSTText to Imagegrok-imagine/text-to-image
input fields
promptstringrequired

Text prompt describing the desired image (max 5000 chars)

aspect_ratioenum<string>optional

Width-to-height ratio of generated image

nsfw_checkerbooleanoptional

Content filtering; disabled when false

enable_probooleanoptional

Quality mode (true) vs speed mode (false)

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/text-to-image",
  "input": {
    "prompt": "A cinematic red panda surfing through neon rain at dusk.",
    "aspect_ratio": "1:1",
    "nsfw_checker": false,
    "enable_pro": false
  }
}'

Grok Imagine · Image to Image

POSTImage to Imagegrok-imagine/image-to-image
input fields
promptstringoptional

Text description specifying desired content or style

image_urlsarray<string>required

Up to 1 reference image URL (JPEG/PNG/WebP, max 10MB)

nsfw_checkerbooleanoptional

Toggle content filtering; false disables filtering

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/image-to-image",
  "input": {
    "prompt": "A cinematic red panda surfing through neon rain at dusk.",
    "image_urls": [
      "https://example.com/input.jpg"
    ],
    "nsfw_checker": false
  }
}'

Grok Imagine · Text to Video

POSTText to Videogrok-imagine/text-to-video
input fields
promptstringrequired

Text prompt describing desired video motion (max 5000 chars)

aspect_ratioenum<string>optional

Width-to-height ratio of the generated video

modeenum<string>optional

Generation mode affecting style and intensity of motion

durationnumberoptional

Video length in seconds (range 6-30, step 1)

resolutionenum<string>optional

The resolution of the generated video

nsfw_checkerbooleanoptional

Disables content filtering when set to false

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/text-to-video",
  "input": {
    "prompt": "A cinematic red panda surfing through neon rain at dusk.",
    "aspect_ratio": "2:3",
    "mode": "normal",
    "duration": 5,
    "resolution": "480p",
    "nsfw_checker": false
  }
}'

Grok Imagine · Image to Video

POSTImage to Videogrok-imagine/image-to-video
input fields
image_urlsarray<string>optional

External image URLs for video (max 7, JPEG/PNG/WEBP, 10MB each)

task_idstringoptional

Task ID from previous Grok text-to-image generation (max 100 chars)

indexintegeroptional

Image index when using task_id (0-5, 0-based)

promptstringoptional

Text describing desired video motion (max 5000 chars)

modeenum<string>optional

Generation mode: fun, normal, spicy

durationstringoptional

Video duration in seconds (6-30 range, 1 second steps)

resolutionenum<string>optional

Output video resolution

aspect_ratioenum<string>optional

Video aspect ratio for multi-image mode

nsfw_checkerbooleanoptional

Enable content filtering (disabled by default)

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/image-to-video",
  "input": {
    "image_urls": [
      "https://example.com/input.jpg"
    ],
    "task_id": "example",
    "index": 0,
    "prompt": "Animate the image with natural motion, subtle camera movement, and cinematic lighting.",
    "mode": "normal",
    "duration": 5,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "nsfw_checker": false
  }
}'

Grok Imagine · Image to Video

POSTImage to Videogrok-imagine/upscale
input fields
task_idstringrequired

Task ID from a previously successful video generation task

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/upscale",
  "input": {
    "task_id": "example"
  }
}'

Grok Imagine · Image to Video

POSTImage to Videogrok-imagine/extend
input fields
task_idstringrequired

Task ID from previous video generation (Kie AI models only)

promptstringrequired

Text instructions describing desired video movement and expansion

extend_atnumberoptional

Starting position for video extension

extend_timesnumberrequired

Duration of video extension in seconds (6 or 10 seconds)

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/extend",
  "input": {
    "task_id": "example",
    "prompt": "Animate the image with natural motion, subtle camera movement, and cinematic lighting.",
    "extend_at": 2,
    "extend_times": 1
  }
}'

Grok Imagine 1.5 Preview · Image to Video

POSTImage to Videogrok-imagine/1-5-preview
input fields
promptstringrequired

Prompt for video generation (max 4096 chars)

image_urlsarray<string>optional

Image files for input (JPEG/PNG/WebP/JPG, max 20MB, up to 1 file)

aspect_ratioenum<string>optional

Aspect ratio for video generation

resolutionenum<string>optional

Resolution for video generation

durationintegeroptional

Video duration in seconds (range 1-15)

nsfw_checkerbooleanoptional

If set to false, content filtering is disabled

Example
cURL
curl -X POST https://api.lithovas.com/api/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/1-5-preview",
  "input": {
    "prompt": "Animate the image with natural motion, subtle camera movement, and cinematic lighting.",
    "image_urls": [
      "https://example.com/input.jpg"
    ],
    "aspect_ratio": "auto",
    "resolution": "480p",
    "duration": 8,
    "nsfw_checker": false
  }
}'