Skip to main content
POST
Use este endpoint para iniciar uma tarefa Grok de image-to-video a partir de uma imagem de origem e um prompt. Ele retorna um request_id imediatamente, então trate-o como a primeira etapa de um fluxo assíncrono.

Comece com uma solicitação pequena

  • Use model: grok-imagine-video-1.5
  • Defina image.url como uma URL pública JPEG, PNG ou WebP
  • Na primeira solicitação, mantenha duration em 1 e resolution em 720p
  • Mantenha o prompt explícito para que a direção da animação fique clara
  • Se você enviar base64, mantenha a forma dos exemplos da documentação e do OpenAPI como data:image/png;base64,<BASE64_IMAGE_DATA>

Duração e resolução

Fluxo da tarefa

1

Criar a tarefa

Envie o prompt e a imagem de origem, depois salve o request_id retornado.
2

Consultar até a conclusão

Chame Obter resultados de vídeo xAI até que o status aninhado do provedor se torne done.
3

Persistir a saída

Copie a video.url final para o seu próprio armazenamento se precisar dela após a janela temporária de entrega do provedor.

Autorizações

Authorization
string
header
obrigatório

Bearer token authentication. Use your CometAPI key.

Corpo

application/json
prompt
string
obrigatório

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

Exemplo:

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

Opções disponíveis:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
padrão: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
padrão:grok-imagine-video-1.5

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

Exemplo:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
padrão:720p

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

Opções disponíveis:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

Resposta

200 - application/json

Request accepted.

request_id
string
obrigatório

Deferred request id used for polling.