MercadoSoporte← Volver a la app

Grok Imagine

Los modelos de Grok Imagine se llaman a través de una API de trabajos asíncrona y unificada. Inicia una tarea con POST /api/generate y luego sondea GET /api/generate/{taskId} hasta que termine. Esta familia expone 7 endpoints.

Resumen

Todos los endpoints comparten la misma envoltura — solo cambian model y los campos input. Ejecuta cualquiera desde el playground del Mercado de modelos.

Autenticación

Crea una API key en /api-keys y luego envíala como token Bearer. Las solicitudes desde el navegador con sesión iniciada también funcionan mediante la cookie de sesión.

Authorization: Bearer <YOUR_API_KEY>

Crear tarea

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

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

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

Consultar resultado

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

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

Asíncrono
Un 200 de Crear tarea solo significa que la tarea fue aceptada — no que haya terminado. Sondea este endpoint hasta que state sea success o fail. Las tareas fallidas no se facturan.

Endpoints

ModeloTareamodel 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
campos input
promptstringobligatorio

Text prompt describing the desired image (max 5000 chars)

aspect_ratioenum<string>opcional

Width-to-height ratio of generated image

nsfw_checkerbooleanopcional

Content filtering; disabled when false

enable_probooleanopcional

Quality mode (true) vs speed mode (false)

Ejemplo
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
campos input
promptstringopcional

Text description specifying desired content or style

image_urlsarray<string>obligatorio

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

nsfw_checkerbooleanopcional

Toggle content filtering; false disables filtering

Ejemplo
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
campos input
promptstringobligatorio

Text prompt describing desired video motion (max 5000 chars)

aspect_ratioenum<string>opcional

Width-to-height ratio of the generated video

modeenum<string>opcional

Generation mode affecting style and intensity of motion

durationnumberopcional

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

resolutionenum<string>opcional

The resolution of the generated video

nsfw_checkerbooleanopcional

Disables content filtering when set to false

Ejemplo
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
campos input
image_urlsarray<string>opcional

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

task_idstringopcional

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

indexintegeropcional

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

promptstringopcional

Text describing desired video motion (max 5000 chars)

modeenum<string>opcional

Generation mode: fun, normal, spicy

durationstringopcional

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

resolutionenum<string>opcional

Output video resolution

aspect_ratioenum<string>opcional

Video aspect ratio for multi-image mode

nsfw_checkerbooleanopcional

Enable content filtering (disabled by default)

Ejemplo
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
campos input
task_idstringobligatorio

Task ID from a previously successful video generation task

Ejemplo
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
campos input
task_idstringobligatorio

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

promptstringobligatorio

Text instructions describing desired video movement and expansion

extend_atnumberopcional

Starting position for video extension

extend_timesnumberobligatorio

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

Ejemplo
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
campos input
promptstringobligatorio

Prompt for video generation (max 4096 chars)

image_urlsarray<string>opcional

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

aspect_ratioenum<string>opcional

Aspect ratio for video generation

resolutionenum<string>opcional

Resolution for video generation

durationintegeropcional

Video duration in seconds (range 1-15)

nsfw_checkerbooleanopcional

If set to false, content filtering is disabled

Ejemplo
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
  }
}'