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

# 视频生成（原生接口）

> 使用 Gemini 原生接口创建视频任务

<Note>
  推荐使用 [OpenAI 兼容接口](/gemini/video)，更简洁易用。原生接口适用于需要特定参数的场景。
</Note>

## 创建视频任务

```bash theme={null}
curl -X POST "$BASE_URL/v1beta/models/veo-3.1-generate-preview:predictLongRunning" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "instances": [{
      "prompt": "a drone rises from a beach at sunset, cinematic"
    }],
    "parameters": {
      "durationSeconds": 6,
      "aspectRatio": "16:9",
      "resolution": "720p"
    }
  }'
```

响应：

```json theme={null}
{
  "name": "operations/abc123xyz",
  "done": false
}
```

## 图生视频

### 单图

```json theme={null}
{
  "instances": [{
    "prompt": "night city with neon rain",
    "image": {"uri": "https://example.com/ref.jpg"}
  }],
  "parameters": {
    "durationSeconds": 6,
    "aspectRatio": "16:9"
  }
}
```

### 首尾帧

```json theme={null}
{
  "instances": [{
    "prompt": "transition effect",
    "image": {"uri": "https://example.com/first.jpg"}
  }],
  "parameters": {
    "durationSeconds": 6,
    "lastFrame": {"uri": "https://example.com/last.jpg"}
  }
}
```

## 查询任务

```bash theme={null}
curl "$BASE_URL/v1beta/operations/{operation_id}" \
  -H "Authorization: Bearer $TOKEN"
```

完成后响应：

```json theme={null}
{
  "name": "operations/abc123xyz",
  "done": true,
  "response": {
    "generateVideoResponse": {
      "generatedSamples": [{
        "video": {"uri": "https://.../video.mp4"}
      }]
    }
  }
}
```

## 参数说明

| 参数                           | 说明                 |
| ---------------------------- | ------------------ |
| `instances[].prompt`         | 文本提示词              |
| `instances[].image.uri`      | 首帧图片 URL           |
| `parameters.durationSeconds` | 时长（秒）              |
| `parameters.aspectRatio`     | 宽高比：`16:9`、`9:16`  |
| `parameters.resolution`      | 分辨率：`720p`、`1080p` |
| `parameters.lastFrame.uri`   | 尾帧图片 URL           |
