Home/Models/xAI/Grok Imagine Video
X

Grok Imagine Video

每秒:$0.04
可根據文字提示生成影片,將靜態圖片動態化,或以自然語言編輯現有影片。API 支援為生成的影片自訂時長、寬高比與解析度 — SDK 會自動處理非同步輪詢。
新
商業用途
概覽
功能
定價
API

📘 Grok Imagine Video 的技術規格

規格詳細資訊
Model IDgrok-imagine-video
ProviderxAI
Type影片生成與編輯 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透過臨時 URL 提供 .mp4 影片
Duration Range (generate)1–15 秒
Resolution480p、720p(可設定)
Aspect Ratios1:1、16:9、9:16
Edit Support是 — 可為影片添加動畫並修改,最長至 8.7s
Moderation包含內容審核
Pricing依秒計費,費率隨解析度而變

🚀 什麼是 Grok Imagine Video?

Grok Imagine Video 是 xAI 的進階影片生成與編輯 AI 模型,透過 CometAPI 對外提供。它讓開發者能從自然語言提示生成短、客製化影片,並可選擇將靜態圖片動畫化或編輯現有片段。該模型支援可設定的輸出長度、解析度與長寬比,且內建內容審核以確保遵循政策。

🧠 主要功能(Grok Imagine 的差異點)

  • 原生音訊 + 對嘴同步:生成同步的環境音效、效果與短語音/旁白,並提供近似的對嘴同步。
  • 圖像→影片 / 提示詞編輯:可將靜態圖片動畫化,或透過文字提示編輯現有影片(移除/替換物件、調整時間、改變風格)。
  • 快速迭代與低延遲:為快速回饋循環設計,適用於創作流程與產品原型。
  • 生產級 API:Imagine API 提供可程式化端點,支援批量生成、整合至剪輯流程與企業級控管。
  • 多種「模式」/ 風格:面向使用者的模式(據報示例:Normal / Fun / Spicy 或類似預設)以偏向輸出風格或寬鬆程度(注意:「Spicy」模式歷史上曾啟用 NSFW)。
模型(公司)最高解析度(公開)最大片長(公開)原生音訊?優勢注意事項
Grok Imagine (xAI)720p6–15s是快速迭代、成本/延遲表現佳、整合式編輯、原生音訊僅支援至 720p;審核引發顧慮;真實世界擬真度表現不一
Sora (OpenAI)720p–1080p(取決於等級)短(6–15s)是高視覺擬真度;與 OpenAI 生態高度整合成本較高;審核/控管更為嚴格
Veo (Google DeepMind)最高至 1080p+短(不定)是高擬真度、動作穩定成本更高;公開試驗較少
Runway Gen-4.51080p+短(不定)是業界採用度高、適合創作流程、擬真度高成本較高;專注於創作工具
Vidu / Kling / Pika(各類專家)最高至 1080p短(不定)不一部分提供利基功能(Smart Cuts、多鏡頭串接)音訊支援不一;API 成熟度差異

⚠️ 限制

  • 最長影片長度上限為 15 秒。
  • 編輯保留輸入影片長度(≤ 8.7s)。
  • 產生的 URL 為臨時連結 — 請盡速下載。

如何存取與整合 Grok Imagine Video

Step 1: 申請 API Key

登入 cometapi.com。若您尚未成為使用者,請先註冊。登入您的 CometAPI console。取得介面存取憑證 API key。點擊個人中心的 API token 處「Add Token」,取得 token key:sk-xxxxx 並提交。

Step 2: 向 Grok Imagine Video API 發送請求

選擇 “grok-imagine-video” 端點以發送 API 請求並設定請求主體。請求方法與請求主體可從我們網站的 API 文件取得。我們的網站亦提供 Apifox 測試以利使用。請將 <YOUR_API_KEY> 替換為您帳戶中的實際 CometAPI key。呼叫位置:GROK 影片生成 與 影片編輯。

Step 3: 向 Grok Imagine Video API 發送請求

輸入文字或上傳圖片(您可以選擇提供來源圖片以進行動畫化)。Grok Imagine AI API 會分析您的輸入並準備可供存取的 URL。支援文字轉影片與圖片轉影片。

來源圖片可透過以下方式提供:

  • 指向圖片的公開 URL
  • base64 編碼的 data URI(例如,data:image/jpeg;base64,<YOUR_BASE64_IMAGE>)

Step 4: 取得並驗證結果

處理 API 回應以取得生成結果。提交後,API 會回應任務狀態與輸出資料;會立即返回 request_id,請使用 GET 端點查詢狀態並取得生成的影片。影片編輯為非同步流程,您可能需要多次輪詢該端點直到任務完成。請儘速下載。

常見問題

How do I generate a video using grok-imagine-video API?

You send a POST request with model 'grok-imagine-video' including a text prompt and optional image/video source; it returns a task ID, then poll this ID until the video status is 'done'.

What input formats does grok-imagine-video accept?

It accepts a natural language prompt and optional image URLs (or base64 images) for animation; for editing, a video URL is provided.

What are the maximum video duration and resolution options?

The model supports video generation up to 15 seconds and resolutions up to 720p with configurable aspect ratios like 16:9 or 1:1.

Can I animate a still image into a video with this model?

Yes, you can animate a still image into motion based on your prompt, using image URLs or encoded images in the request.

Does grok-imagine-video support editing existing videos?

Yes — provide the source video URL and your edit instructions; the output keeps the original video’s duration and resolution.

How does moderation work in grok-imagine-video outputs?

Generated videos are subject to content moderation; flagged content may be filtered or blocked during generation.

Is the video generation asynchronous?

Yes, the API returns a request ID which you poll to check when the video is ready for download.

How should I handle expired video URLs?

Downloaded videos should be saved quickly; temporary URLs may expire and become inaccessible after generation.

Grok Imagine Video 的功能

探索 Grok Imagine Video 的核心功能,專為提升效能和可用性而設計。了解這些功能如何為您的專案帶來效益並改善使用者體驗。

Grok Imagine Video 的定價

探索 Grok Imagine Video 的競爭性定價,專為滿足各種預算和使用需求而設計。我們靈活的方案確保您只需為實際使用量付費,讓您能夠隨著需求增長輕鬆擴展。了解 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 資源,以簡化您的 Grok Imagine Video 整合流程。我們詳盡的文件提供逐步指引,協助您在專案中充分發揮 Grok Imagine Video 的潛力。
Python
JavaScript
Curl
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("
Step 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)

更多模型