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

# 下载视频 · Gemini API

> 使用查询响应返回的完整 video.uri 下载视频。

把 `<VIDEO_URL>` 替换为实际返回的 `response.generateVideoResponse.generatedSamples[0].video.uri`：

```bash theme={"system"}
curl --fail -L -o video.mp4 "<VIDEO_URL>" \
  -H "Authorization: Bearer <AIOHUB_API_KEY>"
```

使用返回的完整 `uri`，保留 `:download?alt=media`。不要自行拼接文件名；Google GenAI SDK 可通过 `files.download` 处理这个地址。

`file` 是返回地址中的文件名，不是 `task_id`，也不是整个 URL。需要创建任务所属账号的 API 令牌；成功后 72 小时内有效，过期返回 410。


## OpenAPI

````yaml openapi/relay.json GET /v1beta/files/{file}:download
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub 公开 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: 获取模型列表
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: 图片生成
  - name: OpenAI 图像
  - name: 视频生成
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: 文本补全
  - name: OpenAI 音频
  - name: Realtime API
paths:
  /v1beta/files/{file}:download:
    get:
      tags:
        - 视频生成
      summary: 下载 Gemini 视频
      description: >
        任务成功后，使用 video.uri 中返回的完整下载地址。file 是返回地址中的文件名，不是 task_id，也不要传入整个
        URL。下载需要 API 令牌；成功后 72 小时内有效。
      operationId: downloadSeedanceGeminiVideo
      parameters:
        - name: file
          in: path
          required: true
          description: 返回 URI 中 files/ 与 :download 之间的文件名。
          schema:
            type: string
            example: 7461736b5f6578616d706c65
          example: 7461736b5f6578616d706c65
        - name: alt
          in: query
          required: true
          schema:
            type: string
            enum:
              - media
            default: media
          description: 使用 media 下载二进制文件。
        - name: Range
          in: header
          required: false
          schema:
            type: string
          description: 可选字节范围，例如 bytes=0-1023。
      responses:
        '200':
          description: MP4 视频文件。
          content:
            video/mp4:
              schema:
                type: string
                format: binary
        '206':
          description: 请求范围内的视频内容。
          content:
            video/mp4:
              schema:
                type: string
                format: binary
        '400':
          description: 任务尚未完成。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGoogleFileError'
        '401':
          description: API 令牌缺失或无效。
        '404':
          description: 文件不存在或不属于当前账号。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGoogleFileError'
        '410':
          description: 视频已超过保留期限。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGoogleFileError'
        '416':
          description: 请求的字节范围无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGoogleFileError'
        '502':
          description: 视频文件暂时无法读取。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGoogleFileError'
      security:
        - BearerAuth: []
components:
  schemas:
    SeedanceGoogleFileError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP 状态码。
            message:
              type: string
              description: 错误说明。
            status:
              type: string
              description: Google 格式的错误状态。
          required:
            - code
            - message
            - status
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````

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