> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbrod.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok Imagine Video 1.5

> - 支持文生视频、首尾帧和参考图生成
- 最多 14 张参考图与 4 个时间关键帧
- 支持参考音频及有声视频
- 最高 720p，时长 1–15 秒

```bash cURL theme={null}
curl -X POST 'https://ai.xbrod.com/v1/videos' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"model":"grok-imagine-video-1.5","prompt":"镜头缓缓掠过海岸，海浪与风声自然同步","duration":8,"aspect_ratio":"16:9","resolution":"720p"}'
```

```python Python theme={null}
import requests

response = requests.post('https://ai.xbrod.com/v1/videos',
    headers={'Authorization': 'Bearer <token>'},
    json={
        'model': 'grok-imagine-video-1.5',
        'prompt': '镜头缓缓掠过海岸，海浪与风声自然同步',
        'duration': 8,
        'aspect_ratio': '16:9',
        'resolution': '720p',
    })
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch('https://ai.xbrod.com/v1/videos', {
  method: 'POST',
  headers: { Authorization: 'Bearer <token>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: 'grok-imagine-video-1.5',
    prompt: '镜头缓缓掠过海岸，海浪与风声自然同步',
    duration: 8,
    aspect_ratio: '16:9',
    resolution: '720p',
  }),
});
console.log(await response.json());
```

```go Go theme={null}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    body := []byte(`{"model":"grok-imagine-video-1.5","prompt":"海岸边的日出","duration":8,"aspect_ratio":"16:9","resolution":"720p"}`)
    req, err := http.NewRequest("POST", "https://ai.xbrod.com/v1/videos", bytes.NewReader(body))
    if err != nil { panic(err) }
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")
    resp, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer resp.Body.Close()
    result, err := io.ReadAll(resp.Body)
    if err != nil { panic(err) }
    fmt.Println(string(result))
}
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        var request = HttpRequest.newBuilder(URI.create("https://ai.xbrod.com/v1/videos"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString("{\"model\":\"grok-imagine-video-1.5\",\"prompt\":\"海岸边的日出\",\"duration\":8,\"aspect_ratio\":\"16:9\",\"resolution\":\"720p\"}"))
            .build();
        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```php PHP theme={null}
<?php
$ch = curl_init('https://ai.xbrod.com/v1/videos');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer <token>', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"model":"grok-imagine-video-1.5","prompt":"海岸边的日出","duration":8,"aspect_ratio":"16:9","resolution":"720p"}',
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
if ($result === false) { throw new RuntimeException(curl_error($ch)); }
curl_close($ch);
echo $result;
```

```ruby Ruby theme={null}
require 'net/http'

uri = URI('https://ai.xbrod.com/v1/videos')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = '{"model":"grok-imagine-video-1.5","prompt":"海岸边的日出","duration":8,"aspect_ratio":"16:9","resolution":"720p"}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
puts response.body
```

## 请求参数

**model** `string` *required*

视频生成模型名称：`grok-imagine-video-1.5`。

**prompt** `string`

视频的文本描述，最多 100,000 UTF-8 字节。没有首帧、尾帧或关键帧时必填；可描述对白、环境声和音乐。

**duration** `number` (default: 8)

生成时长（秒），1–15 秒，默认 8 秒；具体时长须当前模型线路支持。

**aspect\_ratio** `string` (default: 16:9)

视频宽高比：`1:1`、`16:9`、`9:16`、`4:3`、`3:4`、`3:2`、`2:3`。

**resolution** `string` (default: 720p)

视频分辨率：`480p` 或 `720p`。使用参考图、参考音频或关键帧时最高 720p。

**image** `object`

首帧图片，例如 `{"url":"https://example.com/first.jpg"}`。使用图片 HTTP(S) URL、Data URL 或同一上游账户的 `input_` 文件标识；`url` 与 `file_id` 二选一。

**last\_frame** `object`

尾帧图片，格式同 `image`。

**reference\_images** `object[]`

参考图片列表，最多 14 张；与首帧、尾帧、关键帧分别计数。示例：`[{"url":"https://example.com/person.jpg"}]`。

**keyframes** `object[]`

最多 4 个时间关键帧。每项提供 `image` 和 `timestamp_s`；时间须在视频内部，按 1/3 秒网格取整后不能与端点或其他关键帧重叠。示例：`[{"image":{"url":"https://example.com/frame.jpg"},"timestamp_s":2}]`。

**reference\_audios** `object[]`

最多 3 个参考音频对象：`{"voice_id":"eve"}`、`{"url":"https://example.com/speech.wav"}` 或 `{"data":"<base64>","format":"mp3"}`。音色 ID 不能与 URL 或 Base64 音频混用；支持 mp3、wav、m4a、aac、ogg、webm、flac，具体音色由当前线路决定。

**seconds** `number`

`duration` 的别名；同时提供时两者须一致。

**size** `string`

像素尺寸 `1280x720` 或 `720x1280`；映射为 720p 横屏或竖屏，不能与 `aspect_ratio`、`resolution` 冲突。

**input\_reference** `object`

首帧 `image` 的别名，两者不能同时提供。multipart 可使用单张图片文件，文件不超过 20 MiB、请求体不超过 32 MiB。

**user** `string`

用于标记请求用户的可选字符串。

## 返回说明

提交任务后返回 `id`、`object`、`status` 和 `model`。视频文件尚未生成时，请勿重复提交。使用 `GET /v1/videos/{id}` 查询状态；完成后通过 `GET /v1/videos/{id}/content` 获取视频。

**id** `string`

任务 ID。

**object** `string`

对象类型。

**status** `string`

任务状态。

**model** `string`

模型名称。

参数缺失、模型未启用或超出限制时返回 `400`。视频编辑使用 `POST /v1/videos/edits`。

## 视频延长

使用 `POST /v1/videos/extensions`，传入源视频的公网地址，从源视频末尾继续生成。

| 参数 | 说明 |
| - | - |
| `model` | 必填，`grok-imagine-video-1.5`。 |
| `prompt` | 必填，描述新增片段。 |
| `video.url` | 必填，公开可访问的源视频 HTTP(S) 地址；源文件不超过 20 MiB。 |
| `duration` | 新增片段的时长，6–10 秒，默认 6 秒。 |
| `video_extension_start_time` | 必填，填源视频末尾的实际时间（秒），必须大于 0。例如源视频长 5.088 秒，传 `5.088`。 |

```bash theme={null}
curl -X POST 'https://ai.xbrod.com/v1/videos/extensions' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"model":"grok-imagine-video-1.5","prompt":"延续原视频最后一帧，保持镜头运动和场景连贯。","video":{"url":"https://example.com/source.mp4"},"duration":6,"video_extension_start_time":5.088}'
```

提交后返回任务 `id`；使用 `GET /v1/videos/{id}` 查询状态，完成后使用 `GET /v1/videos/{id}/content` 获取视频。按新增片段时长计费，不按最终成片总时长计费。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.