Skip to main content
POST
Usa questo endpoint per avviare un job Grok da immagine a video a partire da un’immagine sorgente e un prompt. Restituisce immediatamente un request_id, quindi trattalo come il primo passaggio di un flusso di lavoro asincrono.

Inizia con una richiesta piccola

  • Usa model: grok-imagine-video-1.5
  • Imposta image.url su un URL pubblico JPEG, PNG o WebP
  • Per una prima richiesta, mantieni duration a 1 e resolution a 720p
  • Mantieni prompt esplicito in modo che la direzione dell’animazione sia chiara
  • Se invii base64, mantieni nei documenti e nell’esempio OpenAPI il formato data:image/png;base64,<BASE64_IMAGE_DATA>

Durata e risoluzione

Flusso dell’attività

1

Create the job

Invia il prompt e l’immagine sorgente, quindi salva il request_id restituito.
2

Poll for completion

Chiama Get xAI video results finché lo stato annidato del provider non diventa done.
3

Persist the output

Copia il video.url finale nel tuo sistema di archiviazione se ti serve dopo la finestra di distribuzione temporanea del provider.

Autorizzazioni

Authorization
string
header
obbligatorio

Bearer token authentication. Use your CometAPI key.

Corpo

application/json
prompt
string
obbligatorio

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

Esempio:

"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.

Opzioni disponibili:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
predefinito: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
predefinito:grok-imagine-video-1.5

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

Esempio:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
predefinito:720p

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

Opzioni disponibili:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

Risposta

200 - application/json

Request accepted.

request_id
string
obbligatorio

Deferred request id used for polling.