xAI
视频生成
使用 CometAPI 的 POST /grok/v1/videos/generations 通过 Grok 创建视频,基于 prompt 为输入图片添加动画效果,并通过 request_id 轮询结果。
POST
使用此端点可通过文本,或通过文本加一张源图像来启动一个 Grok 视频任务。它会立即返回一个Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
request_id,因此请将其视为异步工作流中的第一步。
从小请求开始
- 使用
model: grok-imagine-video - 首次请求时,将
duration保持为1,并将resolution保持为480p - 仅当你希望进行图生视频时才添加
image.url - 如果你发送 base64,请将文档和 OpenAPI 示例格式保持为
data:image/png;base64,<BASE64_IMAGE_DATA>
任务流程
轮询完成状态
调用 获取视频生成结果,直到嵌套的 provider 状态变为
done。授权
Bearer token authentication. Use your CometAPI key.
请求体
application/json
Prompt for the video job.
示例:
"A candle flickers on a wooden table."
Output aspect ratio.
可用选项:
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. xAI documents a range of 1 to 15 seconds.
Optional source image for image-to-video.
xAI video model id.
示例:
"grok-imagine-video"
Output resolution.
可用选项:
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
响应
200 - application/json
Request accepted.
Deferred request id used for polling.