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

# predictLongRunning

> 使用Gemini模型创建视频生成任务。支持文本到视频和基于源视频的生成。

使用 Veo 3 模型创建视频生成任务。支持文本到视频和基于参考图片的视频生成。


## OpenAPI

````yaml POST /v1beta/models/{model}:predictLongRunning
openapi: 3.1.0
info:
  title: TokenOps AI API
  description: TokenOps AI API 提供了强大的AI服务能力，包括聊天对话、Gemini模型集成等功能。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://model-api.skyengine.com.cn
    description: TokenOps AI API 生产环境
security: []
paths:
  /v1beta/models/{model}:predictLongRunning:
    post:
      summary: 创建长时间运行的视频生成任务
      description: 使用Gemini模型创建视频生成任务。支持文本到视频和基于源视频的生成。
      operationId: predictLongRunning
      parameters:
        - name: model
          in: path
          required: true
          description: 视频生成模型名称，如 veo-3.1-generate-preview
          schema:
            type: string
            example: veo-3.1-generate-preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VertexVideoRequest'
            examples:
              text_to_video:
                summary: 文本到视频生成
                description: 根据文本提示生成视频
                value:
                  instances:
                    - prompt: 一只可爱的小猫在花园里玩耍，阳光明媚
                  parameters:
                    aspectRatio: '16:9'
                    durationSeconds: 4
                    sampleCount: 1
              image_to_video:
                summary: 图片到视频生成
                description: 基于图片和文本提示生成视频
                value:
                  instances:
                    - prompt: 小猫开始在花园里奔跑
                      image:
                        uri: >-
                          tokenops://bucket.example.com/file_api/20241016/cat.jpg
                        mimeType: image/jpeg
                  parameters:
                    aspectRatio: '16:9'
                    durationSeconds: 4
                    sampleCount: 1
              video_to_video:
                summary: 视频到视频生成
                description: 基于源视频和文本提示生成新视频
                value:
                  instances:
                    - prompt: 将场景改为夜晚，添加星空背景
                      video:
                        uri: >-
                          tokenops://bucket.example.com/file_api/20241016/source.mp4
                        mimeType: video/mp4
                  parameters:
                    aspectRatio: '16:9'
                    durationSeconds: 4
                    sampleCount: 1
      responses:
        '200':
          description: 视频生成任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationName'
              examples:
                operation_created:
                  summary: 任务创建成功
                  value:
                    name: >-
                      projects/my-project/locations/us-central1/operations/operation-1234567890abcdef
        '400':
          description: 客户端错误（包括请求参数错误、API密钥无效等）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    VertexVideoRequest:
      type: object
      required:
        - instances
        - parameters
      properties:
        instances:
          type: array
          description: 视频生成实例列表
          items:
            $ref: '#/components/schemas/VertexVideoInstance'
        parameters:
          $ref: '#/components/schemas/VertexVideoParameters'
          description: 视频生成参数
    OperationName:
      type: object
      properties:
        name:
          type: string
          description: 操作名称，用于后续查询操作状态
          example: >-
            projects/my-project/locations/us-central1/operations/operation-123456789
      required:
        - name
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Status'
          description: 错误信息
    VertexVideoInstance:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: 文本提示
          example: 一只可爱的小猫在花园里玩耍
        image:
          $ref: '#/components/schemas/VertexVideoAsset'
          description: 参考图片
        lastFrame:
          $ref: '#/components/schemas/VertexVideoAsset'
          description: 最后一帧图片
        video:
          $ref: '#/components/schemas/VertexVideoAsset'
          description: 源视频
        referenceImages:
          type: array
          description: 参考图片列表
          items:
            $ref: '#/components/schemas/VertexVideoReferenceImage'
    VertexVideoParameters:
      type: object
      properties:
        aspectRatio:
          type: string
          description: 可选。指定所生成视频的宽高比。接受的值："16:9" 或 "9:16"。
          enum:
            - '16:9'
            - '9:16'
          example: '16:9'
        compressionQuality:
          type: string
          description: 可选。指定所生成视频的压缩质量。可接受的值为 "optimized" 或 "lossless"。默认值为 "optimized"
          enum:
            - optimized
            - lossless
          default: optimized
          example: optimized
        durationSeconds:
          type: integer
          description: >-
            必需。您要生成的视频文件的时长（以秒为单位）。Veo 2 模型：5-8，默认值为 8。Veo 3 模型：4、6 或 8，默认为 8。使用
            referenceImages 时：8
          enum:
            - 4
            - 5
            - 6
            - 7
            - 8
          default: 8
          example: 8
        enhancePrompt:
          type: boolean
          description: 可选。使用 Gemini 优化提示。接受的值包括 true 或 false。默认值为 true
          default: true
        generateAudio:
          type: boolean
          description: >-
            Veo 3 模型必须具有此参数。为视频生成音频。接受的值包括 true 或 false。generateAudio 不受
            veo-2.0-generate-001 或 veo-2.0-generate-exp 支持
          default: false
        negativePrompt:
          type: string
          description: 可选。一个文本字符串，用于描述您想要阻止模型生成的内容。例如：顶部照明、明亮的色彩；人物、动物；多辆汽车、风
          example: 顶部照明、明亮的色彩
        personGeneration:
          type: string
          description: >-
            可选。用于控制是否允许人物或人脸生成的安全设置。"allow_adult"（默认值）：仅允许生成成人；"dont_allow"：禁止在图片中包含人物/人脸
          enum:
            - allow_adult
            - dont_allow
          default: allow_adult
          example: allow_adult
        resizeMode:
          type: string
          description: >-
            可选。仅限 Veo 3 模型，与 image 搭配使用，可实现图像转视频。模型用于调整视频大小的调整模式。接受的值包括
            "pad"（默认值）或 "crop"
          enum:
            - pad
            - crop
          default: pad
          example: pad
        resolution:
          type: string
          description: 可选。仅限 Veo 3 模型。所生成视频的分辨率。接受的值包括 "720p"（默认值）或 "1080p"
          enum:
            - 720p
            - 1080p
          default: 720p
          example: 720p
        sampleCount:
          type: integer
          description: 可选。请求的输出视频数量。接受的值为1-4
          minimum: 1
          maximum: 4
          default: 1
          example: 1
        seed:
          type: integer
          description: >-
            可选。请求的数字，以使生成的视频具有确定性。在请求中添加种子编号而不更改其他参数会导致模型生成相同的视频。接受的范围为
            0-4,294,967,295
          format: uint32
          minimum: 0
          maximum: 4294967295
          example: 12345
    Status:
      type: object
      properties:
        code:
          type: integer
          description: 错误代码
        message:
          type: string
          description: 错误消息
        details:
          type: array
          description: 错误详情
          items:
            type: object
            additionalProperties: true
    VertexVideoAsset:
      type: object
      properties:
        bytesBase64Encoded:
          type: string
          description: Base64编码的资源数据
        uri:
          type: string
          description: tokenops URI
          example: >-
            tokenops://bucket.example.com/file_api/20241016/video.mp4(or
            image.png)
        mimeType:
          type: string
          description: MIME类型
          example: video/mp4、image/png
    VertexVideoReferenceImage:
      type: object
      required:
        - image
        - referenceType
      properties:
        image:
          $ref: '#/components/schemas/VertexVideoAsset'
          description: 参考图片
        referenceType:
          type: string
          description: 参考类型
          enum:
            - REFERENCE_TYPE_UNSPECIFIED
            - START
            - END
          example: START
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        ModelHub API密钥认证。在 `Authorization` HTTP Header 中包含您的 API-Key，格式为 `Bearer
        {API_KEY}`

````