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

# Veo 3.1 Generate Preview

> Create asynchronous video tasks with veo-3.1-generate-preview via POST /v1/predictions.

## Overview

Google **Veo 3.1 Generate Preview** (`veo-3.1-generate-preview`) supports:

* **Text-to-video** — `prompt` only
* **First / last frame** — `first_frame_url`, `last_frame_url`
* **Reference images** — up to **3** URLs in `reference_image_urls` for consistent subject appearance

## Input parameters

| Field                  | Required | Default | Notes                            |
| ---------------------- | -------- | ------- | -------------------------------- |
| `prompt`               | Yes      | —       | Max **1000** characters          |
| `aspect_ratio`         | No       | `16:9`  | `16:9` or `9:16` only            |
| `resolution`           | No       | `720P`  | `720P`, `1080P`, `4K`            |
| `duration`             | No       | `8`     | `4`, `6`, or `8` (seconds)       |
| `generate_audio`       | No       | `true`  | Include generated audio          |
| `negative_prompt`      | No       | —       | Negative guidance text           |
| `first_frame_url`      | No       | —       | First keyframe image URL         |
| `last_frame_url`       | No       | —       | Last keyframe image URL          |
| `reference_image_urls` | No       | `[]`    | Up to **3** reference image URLs |


## OpenAPI

````yaml en/api-reference/video-series/google/veo-3.1-generate-preview-generate.json POST /v1/predictions
openapi: 3.1.0
info:
  title: Veo 3.1 Generate Preview
  version: 1.0.0
servers:
  - url: https://api.shuyou.ai
security:
  - bearerAuth: []
paths:
  /v1/predictions:
    post:
      tags:
        - Video Generation
      summary: Veo 3.1 Generate Preview
      description: >-
        Google Veo 3.1 Generate Preview (`veo-3.1-generate-preview`) creates
        videos asynchronously via POST /v1/predictions. Supports text-to-video,
        first/last frame, and reference images. Poll [Get a
        prediction](/en/api-reference/task-management/get-prediction) using
        `data.task_id`, or configure top-level `webhook` for completion
        callbacks.
      operationId: createVeo31GeneratePreviewPrediction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Veo31GeneratePreviewPredictionRequest'
            examples:
              text_to_video:
                summary: Text to video
                value:
                  model: veo-3.1-generate-preview
                  input:
                    prompt: >-
                      A cinematic shot of a majestic lion in the savannah at
                      golden hour
                    aspect_ratio: '16:9'
                    resolution: 720P
                    duration: 8
                    generate_audio: true
              text_to_video_minimal:
                summary: Minimal request
                value:
                  model: veo-3.1-generate-preview
                  input:
                    prompt: A cat playing on the grass
              first_last_frame:
                summary: First / last frame
                value:
                  model: veo-3.1-generate-preview
                  input:
                    prompt: Smooth transition between the two keyframes
                    aspect_ratio: '16:9'
                    resolution: 1080P
                    duration: 6
                    first_frame_url: https://example.com/first-frame.png
                    last_frame_url: https://example.com/last-frame.png
                  webhook: https://api.shuyou.ai/backend/api/callback
              with_references:
                summary: Reference images
                value:
                  model: veo-3.1-generate-preview
                  input:
                    prompt: >-
                      A character walking through a neon-lit street, consistent
                      appearance
                    aspect_ratio: '9:16'
                    resolution: 720P
                    duration: 4
                    reference_image_urls:
                      - https://example.com/character-ref.png
      responses:
        '200':
          description: Async task created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictionTaskResponse'
              example:
                data:
                  task_id: 2c4d50261173430290971a2395a3b607
                  task_status: processing
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient quota
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Model access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Veo31GeneratePreviewPredictionRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model ID. Use `veo-3.1-generate-preview` for this endpoint.
          enum:
            - veo-3.1-generate-preview
          default: veo-3.1-generate-preview
          example: veo-3.1-generate-preview
        input:
          $ref: '#/components/schemas/Veo31GeneratePreviewInput'
        webhook:
          type: string
          format: uri
          description: >-
            Optional HTTPS callback URL when the task completes, fails, or is
            cancelled.
    PredictionTaskResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            task_id:
              type: string
              description: Async task ID. Use with Get a prediction or webhook correlation.
              example: 2c4d50261173430290971a2395a3b607
            task_status:
              type: string
              description: Current task status, e.g. `processing`.
              example: processing
          required:
            - task_id
            - task_status
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            type:
              type: string
    Veo31GeneratePreviewInput:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          maxLength: 1000
          description: The text prompt describing the video you want to generate.
          example: A cinematic shot of a majestic lion in the savannah at golden hour
        aspect_ratio:
          type: string
          description: >-
            The aspect ratio of the generated video. Only `16:9` and `9:16` are
            supported.
          enum:
            - '16:9'
            - '9:16'
          default: '16:9'
          example: '16:9'
        resolution:
          type: string
          description: The resolution of the generated video.
          enum:
            - 720P
            - 1080P
            - 4K
          default: 720P
          example: 720P
        duration:
          type: integer
          description: The duration of the generated video in seconds.
          enum:
            - 4
            - 6
            - 8
          default: 8
          example: 8
        generate_audio:
          type: boolean
          description: Whether to generate audio for the video.
          default: true
          example: true
        negative_prompt:
          type: string
          description: A negative prompt to guide the video generation.
        first_frame_url:
          type: string
          format: uri
          description: URL of the first frame of the video.
        last_frame_url:
          type: string
          format: uri
          description: URL of the last frame of the video.
        reference_image_urls:
          type: array
          description: >-
            URLs of reference images for consistent subject appearance. Up to 3
            images.
          items:
            type: string
            format: uri
          maxItems: 3
          default: []
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer YOUR_API_KEY`'

````