Skip to main content
POST
Gunakan endpoint ini untuk memulai job image-to-video Grok dari satu gambar sumber dan sebuah prompt. Endpoint ini segera mengembalikan request_id, jadi perlakukan ini sebagai langkah pertama dalam alur kerja async.

Mulai dengan request kecil

  • Gunakan model: grok-imagine-video-1.5
  • Atur image.url ke URL JPEG, PNG, atau WebP publik
  • Untuk request pertama, pertahankan duration pada 1 dan resolution pada 720p
  • Buat prompt eksplisit agar arah animasinya jelas
  • Jika Anda mengirim base64, pertahankan bentuk contoh docs dan OpenAPI sebagai data:image/png;base64,<BASE64_IMAGE_DATA>

Duration dan resolution

Alur task

1

Create the job

Kirim prompt dan gambar sumber, lalu simpan request_id yang dikembalikan.
2

Poll for completion

Panggil Get xAI video results sampai status provider bertingkat menjadi done.
3

Persist the output

Salin video.url final ke penyimpanan Anda sendiri jika Anda membutuhkannya setelah jendela pengiriman sementara dari provider berakhir.

Otorisasi

Authorization
string
header
wajib

Bearer token authentication. Use your CometAPI key.

Body

application/json
prompt
string
wajib

Prompt describing how the source image should animate. CometAPI requires this field for this route.

Contoh:

"Animate the still image with a slow camera move and natural motion."

aspect_ratio
enum<string>

Output aspect ratio. Combine with resolution to choose the target frame; for example 480p with 1:1 targets 480x480, 720p with 16:9 targets 1280x720, and 720p with 9:16 targets 720x1280. This endpoint does not expose an exact size field.

Opsi yang tersedia:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
default:8

Output duration in seconds. Use an integer from 1 through 15. If omitted, CometAPI treats the request as an 8-second generation for billing and default handling.

image
object

Source image for image-to-video. Use a public JPEG, PNG, or WebP URL, or a data URI such as data:image/png;base64,<BASE64_IMAGE_DATA>.

model
string
default:grok-imagine-video-1.5

xAI video model id. The default example uses Grok Imagine 1.5 for image-to-video.

Contoh:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
default:720p

Output resolution. Use 720p for a small image-to-video test, or 1080p when you need a higher resolution tier.

Opsi yang tersedia:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

Respons

200 - application/json

Request accepted.

request_id
string
wajib

Deferred request id used for polling.