Unlock exclusive introductory pricing for the newly launched Gemini 3.5 Flash.
X

Grok Imagine Video

Секундына:$0.04
Шыққан күні:Feb 27, 2026

Generate videos from text prompts, animate still images, or edit existing videos with natural language. The API supports configurable duration, aspect ratio, and resolution for generated videos — with the SDK handling the asynchronous polling automatically.

Жаңа
Коммерциялық пайдалану

Grok Imagine Video үшін Playground

Grok Imagine Video Playground-ын зерттеңіз — модельдерді тестілеу және нақты уақытта сұрауларды орындауға арналған интерактивті орта. Промпттарды қолданып көріңіз, параметрлерді реттеңіз және дамуды жеделдету және пайдалану жағдайларын растау үшін лезде қайталаңыз.

📘 Technical Specifications of Grok Imagine Video

SpecificationDetails
Model IDgrok-imagine-video
ProviderxAI
TypeVideo generation & editing AI
Input TypesText (prompt); optional image or video Text prompts (natural language); optional image input (image→video); optional video_url for editing existing clips. Editing input video max durations differ by endpoint — reported ~8.7s for some editing flows.
Output Types.mp4 video via temporary URL
Duration Range (generate)1–15 seconds
Resolution480p, 720p (configurable)
Aspect Ratios1:1, 16:9, 9:16
Edit SupportYes — animates & modifies videos up to 8.7s
ModerationContent moderation included
PricingCharged per second, varies by resolution

🚀 What is Grok Imagine Video?

Grok Imagine Video is xAI’s advanced video generation and editing AI model exposed through CometAPI. It lets developers generate short, custom videos from natural language prompts and optionally animate still images or edit existing clips. The model supports configurable output length, resolution, and aspect ratio, with built-in content moderation to ensure policy compliance.

🧠Main features (what differentiates Grok Imagine)

  • Native audio + lip-sync: Generates synchronized ambient audio, effects, and short speech / narration with approximate lip synchronization.
  • Image→Video / prompt editing: Animate a still or edit existing footage via text prompts (remove/replace objects, retime, restyle).
  • Fast iteration & low latency: Designed for quick feedback loops suitable for creative workflows and product prototyping.
  • Production API: Imagine API exposes programmatic endpoints for batch generation, integration into editing pipelines, and enterprise controls.
  • Multiple “modes” / styles: User-facing modes (reported examples: Normal / Fun / Spicy or similar presets) to bias outputs for style or permissiveness (note: “Spicy” mode historically enabled NSFW).
Model (company)Max res (public)Max clip len (public)Native audio?StrengthsCaveats
Grok Imagine (xAI)720p6–15sYesFast iteration, strong cost/latency, integrated editing, native audio720p cap; moderation concerns; varying real-world fidelity
Sora (OpenAI)720p–1080p (depends on tier)short (6–15s)YesHigh visual fidelity; strong integration with OpenAI stackMore expensive; constrained moderation/controls
Veo (Google DeepMind)Up to 1080p+short (varies)YesStrong photorealism, stable motionHigher cost; less public experimentation
Runway Gen-4.51080p+short (varies)YesIndustry adoption for creative workflows, high fidelityCostlier; focused on creative tooling
Vidu / Kling / Pika (various specialists)up to 1080pshort (varies)MixedSome offer niche features (Smart Cuts, multi-shot chaining)Varied audio support; differing API maturity

⚠️ Limitations

  • Maximum video length is capped at 15 seconds.
  • Editing retains input video length (≤ 8.7s).
  • Generated URLs are ephemeral — download promptly.

How to access and integrate Grok Imagine Video

Step 1: Sign Up for API Key

Log in to cometapi.com. If you are not our user yet, please register first. Sign into your CometAPI console. Get the access credential API key of the interface. Click “Add Token” at the API token in the personal center, get the token key: sk-xxxxx and submit.

Step 2: Send Requests to Grok Imagine Video API

Select the “grok-imagine-video” endpoint to send the API request and set the request body. The request method and request body are obtained from our website API doc. Our website also provides Apifox test for your convenience. Replace <YOUR_API_KEY> with your actual CometAPI key from your account. Where to call it: GROKVideo Generation and Video Edit.

Step 3: Send Requests to Grok Imagine Video API

Enter text or upload an image(You can optionally provide a source image to animate.). The Grok Imagine AI API analyzes your input and prepares the content for url. Both text-to-video and image-to-video conversion are supported.

The source image can be provided as:

  • A public URL pointing to an image
  • A base64-encoded data URI( e.g., data:image/jpeg;base64,<YOUR_BASE64_IMAGE>)

Step 4: Retrieve and Verify Results

Process the API response to get the generated answer. After processing, the API responds with the task status and output data. It returns a request_id immediately upon submission; use the GET endpoint to check status and retrieve the generated video. Video editing is asynchronous, you may need to poll this endpoint multiple times until the task is complete. Please download promptly.

ЖҚС

Grok Imagine Video үшін баға белгілеу

[Модель атауы] үшін әртүрлі бюджеттер мен пайдалану қажеттіліктеріне сәйкес келетін бәсекеге қабілетті баға белгілеуді зерттеңіз. Біздің икемді жоспарларымыз сіз тек пайдаланған нәрсеңіз үшін ғана төлеуіңізді қамтамасыз етеді, бұл сіздің талаптарыңыз өскен сайын масштабтауды жеңілдетеді. [Модель атауы] шығындарды басқарылатын деңгейде ұстай отырып, сіздің жобаларыңызды қалай жақсарта алатынын біліңіз.

Pricing Overview

CategoryItemPrice
Input PricingTextN/A (Free)
Image$0.0016
Video per second$0.008
Output Pricing480p$0.04
(Per second by resolution)720p$0.056

Note: When generating video via API, you are charged per second. You will also be charged when using video or images as input.

Grok Imagine Video үшін үлгі код және API

[Модель атауы] үшін кешенді үлгі кодтары мен API ресурстарына қол жеткізіп, интеграция процесіңізді жеңілдетіңіз. Біздің толық құжаттама қадам-қадаммен нұсқаулық береді, жобаларыңызда [Модель атауы] мүмкіндіктерін толық пайдалануға көмектеседі.

#!/bin/bash

# Get your CometAPI key from https://api.cometapi.com/console/token
# Export it as: export COMETAPI_KEY="your-key-here"

BASE_URL="https://api.cometapi.com/grok/v1"

# ============================================================
# Step 1: Create Video Generation Task
# ============================================================
echo "Step 1: Creating video generation task..."

CREATE_RESPONSE=$(curl -s --location --request POST "${BASE_URL}/videos/generations" \
  --header "Authorization: Bearer $COMETAPI_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "model": "grok-imagine-video",
    "prompt": "A glowing crystal-powered rocket launching from the red dunes of Mars, ancient alien ruins lighting up in the background as it soars into a sky full of unfamiliar constellations",
    "duration": 10,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }')

echo "Create response: $CREATE_RESPONSE"

# Extract task ID using jq (install with: brew install jq)
TASK_ID=$(echo "$CREATE_RESPONSE" | jq -r '.request_id // .id')

if [ "$TASK_ID" == "null" ] || [ -z "$TASK_ID" ]; then
  echo "Error: Failed to get task ID from response"
  exit 1
fi

echo "Task ID: $TASK_ID"

# ============================================================
# Step 2: Poll for Task Status
# ============================================================
echo ""
echo "Step 2: Polling task status..."

while true; do
  QUERY_RESPONSE=$(curl -s --location --request GET "${BASE_URL}/videos/${TASK_ID}" \
    --header "Authorization: Bearer $COMETAPI_KEY")

  STATUS=$(echo "$QUERY_RESPONSE" | jq -r '.data.status')
  PROGRESS=$(echo "$QUERY_RESPONSE" | jq -r '.data.progress')
  echo "Status: $STATUS, Progress: $PROGRESS"

  if [ "$STATUS" == "FAILURE" ] || [ "$STATUS" == "failed" ]; then
    echo "Video generation failed!"
    echo "$QUERY_RESPONSE" | jq -r '.data.fail_reason'
    exit 1
  fi

  if [ "$STATUS" == "SUCCESS" ]; then
    VIDEO_URL=$(echo "$QUERY_RESPONSE" | jq -r '.data.data.video.url')
    echo "Video generation completed!"
    echo "Video URL: $VIDEO_URL"
    break
  fi

  sleep 10
done

cURL Code Example

#!/bin/bash

# Get your CometAPI key from https://api.cometapi.com/console/token
# Export it as: export COMETAPI_KEY="your-key-here"

BASE_URL="https://api.cometapi.com/grok/v1"

# ============================================================
# Step 1: Create Video Generation Task
# ============================================================
echo "Step 1: Creating video generation task..."

CREATE_RESPONSE=$(curl -s --location --request POST "${BASE_URL}/videos/generations" \
  --header "Authorization: Bearer $COMETAPI_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "model": "grok-imagine-video",
    "prompt": "A glowing crystal-powered rocket launching from the red dunes of Mars, ancient alien ruins lighting up in the background as it soars into a sky full of unfamiliar constellations",
    "duration": 10,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }')

echo "Create response: $CREATE_RESPONSE"

# Extract task ID using jq (install with: brew install jq)
TASK_ID=$(echo "$CREATE_RESPONSE" | jq -r '.request_id // .id')

if [ "$TASK_ID" == "null" ] || [ -z "$TASK_ID" ]; then
  echo "Error: Failed to get task ID from response"
  exit 1
fi

echo "Task ID: $TASK_ID"

# ============================================================
# Step 2: Poll for Task Status
# ============================================================
echo ""
echo "Step 2: Polling task status..."

while true; do
  QUERY_RESPONSE=$(curl -s --location --request GET "${BASE_URL}/videos/${TASK_ID}" \
    --header "Authorization: Bearer $COMETAPI_KEY")

  STATUS=$(echo "$QUERY_RESPONSE" | jq -r '.data.status')
  PROGRESS=$(echo "$QUERY_RESPONSE" | jq -r '.data.progress')
  echo "Status: $STATUS, Progress: $PROGRESS"

  if [ "$STATUS" == "FAILURE" ] || [ "$STATUS" == "failed" ]; then
    echo "Video generation failed!"
    echo "$QUERY_RESPONSE" | jq -r '.data.fail_reason'
    exit 1
  fi

  if [ "$STATUS" == "SUCCESS" ]; then
    VIDEO_URL=$(echo "$QUERY_RESPONSE" | jq -r '.data.data.video.url')
    echo "Video generation completed!"
    echo "Video URL: $VIDEO_URL"
    break
  fi

  sleep 10
done

Python Code Example

import os
import time
import requests

# Get your CometAPI key from https://api.cometapi.com/console/token, and paste it here
COMETAPI_KEY = os.environ.get("COMETAPI_KEY") or "<YOUR_COMETAPI_KEY>"
BASE_URL = "https://api.cometapi.com/grok/v1"

headers = {
    "Authorization": f"Bearer {COMETAPI_KEY}",
    "Content-Type": "application/json",
}

# ============================================================
# Step 1: Create Video Generation Task
# ============================================================
print("Step 1: Creating video generation task...")

create_payload = {
    "model": "grok-imagine-video",
    "prompt": "A glowing crystal-powered rocket launching from the red dunes of Mars, ancient alien ruins lighting up in the background as it soars into a sky full of unfamiliar constellations",
    "duration": 10,
    "aspect_ratio": "16:9",
    "resolution": "720p",
}

create_response = requests.post(
    f"{BASE_URL}/videos/generations", headers=headers, json=create_payload
)

create_result = create_response.json()
print(f"Create response: {create_result}")

# Extract task ID from the response
task_id = create_result.get("request_id") or create_result.get("id")
if not task_id:
    print("Error: Failed to get task ID from response")
    exit(1)

print(f"Task ID: {task_id}")

# ============================================================
# Step 2: Poll for Task Status
# ============================================================
print("\nStep 2: Polling task status...")

while True:
    query_response = requests.get(
        f"{BASE_URL}/videos/{task_id}", headers=headers
    )
    query_result = query_response.json()

    data = query_result.get("data", {})
    status = data.get("status", "unknown")
    progress = data.get("progress", "0%")
    print(f"Status: {status}, Progress: {progress}")

    if status in ["FAILURE", "failed"]:
        print("Video generation failed!")
        print(f"Reason: {data.get('fail_reason')}")
        exit(1)

    if status == "SUCCESS":
        video_url = data.get("data", {}).get("video", {}).get("url")
        print(f"Video generation completed!")
        print(f"Video URL: {video_url}")
        break

    time.sleep(10)

JavaScript Code Example

// Get your CometAPI key from https://api.cometapi.com/console/token, and paste it here
const api_key = process.env.COMETAPI_KEY || "<YOUR_COMETAPI_KEY>";
const base_url = "https://api.cometapi.com/grok/v1";

const headers = {
  "Authorization": `Bearer ${api_key}`,
  "Content-Type": "application/json",
};

// ============================================================
// Step 1: Create Video Generation Task
// ============================================================
console.log("Step 1: Creating video generation task...");

const createPayload = {
  model: "grok-imagine-video",
  prompt: "A glowing crystal-powered rocket launching from the red dunes of Mars, ancient alien ruins lighting up in the background as it soars into a sky full of unfamiliar constellations",
  duration: 10,
  aspect_ratio: "16:9",
  resolution: "720p",
};

const createResponse = await fetch(`${base_url}/videos/generations`, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(createPayload),
});

const createResult = await createResponse.json();
console.log("Create response:", JSON.stringify(createResult, null, 2));

const taskId = createResult?.request_id || createResult?.id;
if (!taskId) {
  console.log("Error: Failed to get task ID from response");
  process.exit(1);
}

console.log(`Task ID: ${taskId}`);

// ============================================================
// Step 2: Poll for Task Status
// ============================================================
console.log("\nStep 2: Polling task status...");

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

while (true) {
  const queryResponse = await fetch(`${base_url}/videos/${taskId}`, {
    method: "GET",
    headers: headers,
  });

  const queryResult = await queryResponse.json();
  const data = queryResult?.data || {};
  const status = data?.status || "unknown";
  const progress = data?.progress || "0%";
  console.log(`Status: ${status}, Progress: ${progress}`);

  if (["FAILURE", "failed"].includes(status)) {
    console.log("Video generation failed!");
    console.log(`Reason: ${data?.fail_reason}`);
    process.exit(1);
  }

  if (status === "SUCCESS") {
    const videoUrl = data?.data?.video?.url;
    console.log("Video generation completed!");
    console.log(`Video URL: ${videoUrl}`);
    break;
  }

  await sleep(10000);
}