Grok Imagine
Grok Imagine モデルは統一された非同期ジョブ API で呼び出します。POST /api/generate でタスクを開始し、完了するまで GET /api/generate/{taskId} をポーリングします。このファミリーは 7 個のエンドポイントを提供します。
概要
すべてのエンドポイントは同じ外枠を共有し、変わるのは model と input フィールドだけです。モデルマーケットの playground から任意に実行できます。
認証
/api-keys で API キーを作成し、Bearer トークンとして送信します。ログイン中のブラウザからのリクエストはセッション cookie 経由でも動作します。
Authorization: Bearer <YOUR_API_KEY>タスクの作成
POST https://api.lithovas.com/api/generateボディ:{ "model": "<slug>", "input": { … } }
レスポンス:{ "taskId": "<id>", "state": "waiting" }
結果の照会
GET https://api.lithovas.com/api/generate/<taskId>レスポンス:{ "taskId", "state": "waiting" | "success" | "fail", "resultUrls": [ … ], "creditsConsumed", "failMsg", "balance" }
state が success または fail になるまでこのエンドポイントをポーリングしてください。失敗したタスクは課金されません。エンドポイント
| モデル | タスク | model slug |
|---|---|---|
| Grok Imagine | Text to Image | grok-imagine/text-to-image |
| Grok Imagine | Image to Image | grok-imagine/image-to-image |
| Grok Imagine | Text to Video | grok-imagine/text-to-video |
| Grok Imagine | Image to Video | grok-imagine/image-to-video |
| Grok Imagine | Image to Video | grok-imagine/upscale |
| Grok Imagine | Image to Video | grok-imagine/extend |
| Grok Imagine 1.5 Preview | Image to Video | grok-imagine/1-5-preview |
Grok Imagine · Text to Image
grok-imagine/text-to-imagepromptstring必須Text prompt describing the desired image (max 5000 chars)
aspect_ratioenum<string>任意Width-to-height ratio of generated image
nsfw_checkerboolean任意Content filtering; disabled when false
enable_proboolean任意Quality mode (true) vs speed mode (false)
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
grok-imagine/image-to-imagepromptstring任意Text description specifying desired content or style
image_urlsarray<string>必須Up to 1 reference image URL (JPEG/PNG/WebP, max 10MB)
nsfw_checkerboolean任意Toggle content filtering; false disables filtering
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
grok-imagine/text-to-videopromptstring必須Text prompt describing desired video motion (max 5000 chars)
aspect_ratioenum<string>任意Width-to-height ratio of the generated video
modeenum<string>任意Generation mode affecting style and intensity of motion
durationnumber任意Video length in seconds (range 6-30, step 1)
resolutionenum<string>任意The resolution of the generated video
nsfw_checkerboolean任意Disables content filtering when set to false
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
grok-imagine/image-to-videoimage_urlsarray<string>任意External image URLs for video (max 7, JPEG/PNG/WEBP, 10MB each)
task_idstring任意Task ID from previous Grok text-to-image generation (max 100 chars)
indexinteger任意Image index when using task_id (0-5, 0-based)
promptstring任意Text describing desired video motion (max 5000 chars)
modeenum<string>任意Generation mode: fun, normal, spicy
durationstring任意Video duration in seconds (6-30 range, 1 second steps)
resolutionenum<string>任意Output video resolution
aspect_ratioenum<string>任意Video aspect ratio for multi-image mode
nsfw_checkerboolean任意Enable content filtering (disabled by default)
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
grok-imagine/upscaletask_idstring必須Task ID from a previously successful video generation task
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
grok-imagine/extendtask_idstring必須Task ID from previous video generation (Kie AI models only)
promptstring必須Text instructions describing desired video movement and expansion
extend_atnumber任意Starting position for video extension
extend_timesnumber必須Duration of video extension in seconds (6 or 10 seconds)
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
grok-imagine/1-5-previewpromptstring必須Prompt for video generation (max 4096 chars)
image_urlsarray<string>任意Image files for input (JPEG/PNG/WebP/JPG, max 20MB, up to 1 file)
aspect_ratioenum<string>任意Aspect ratio for video generation
resolutionenum<string>任意Resolution for video generation
durationinteger任意Video duration in seconds (range 1-15)
nsfw_checkerboolean任意If set to false, content filtering is disabled
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
}
}'