Skip to main content
POST
Sử dụng endpoint này để khởi tạo một tác vụ image-to-video Grok từ một ảnh nguồn và một prompt. Endpoint sẽ trả về request_id ngay lập tức, vì vậy hãy coi đây là bước đầu tiên trong một quy trình async.

Bắt đầu với một yêu cầu nhỏ

  • Sử dụng model: grok-imagine-video-1.5
  • Đặt image.url thành một URL JPEG, PNG hoặc WebP công khai
  • Với yêu cầu đầu tiên, giữ duration1resolution720p
  • Giữ prompt rõ ràng để hướng chuyển động của animation được xác định cụ thể
  • Nếu bạn gửi base64, hãy giữ nguyên định dạng trong tài liệu và ví dụ OpenAPI là data:image/png;base64,<BASE64_IMAGE_DATA>

Duration và resolution

Luồng tác vụ

1

Tạo tác vụ

Gửi prompt và ảnh nguồn, sau đó lưu request_id được trả về.
2

Thăm dò để hoàn tất

Gọi Lấy kết quả video xAI cho đến khi trạng thái provider lồng nhau trở thành done.
3

Lưu trữ đầu ra

Sao chép video.url cuối cùng vào hệ thống lưu trữ của riêng bạn nếu bạn cần dùng nó sau thời gian cung cấp tạm thời của provider.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Nội dung

application/json
prompt
string
bắt buộc

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

Ví dụ:

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

Tùy chọn có sẵn:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
mặc định: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
mặc định:grok-imagine-video-1.5

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

Ví dụ:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
mặc định:720p

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

Tùy chọn có sẵn:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

Phản hồi

200 - application/json

Request accepted.

request_id
string
bắt buộc

Deferred request id used for polling.