> ## 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.

# Create video · Gemini API

> Submit a Seedance video task using Gemini API, with examples, input limits and full parameters.

Call Seedance through the Gemini API long-running operation format. Poll with GET; successful results appear in `response.generateVideoResponse.generatedSamples`.

For a client using Vertex AI paths, follow the [Vertex AI endpoint](/en/api/video-vertex).

## Setup

Use `https://api.aiohub.org` and authenticate with an AIOHub API key. Replace `<AIOHUB_API_KEY>` with your full `sk-` key and confirm its group can access the selected Seedance model.

## Example request

```bash theme={"system"}
curl "https://api.aiohub.org/v1beta/models/doubao-seedance-2-5-260628:predictLongRunning" \
  -H "Authorization: Bearer <AIOHUB_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "instances": [{
      "prompt": "A blue ceramic cup on a wooden table in daylight."
    }],
    "parameters": {
      "durationSeconds": 4,
      "aspectRatio": "16:9",
      "resolution": "720p",
      "generateAudio": true,
      "sampleCount": 1
    }
  }'
```

The response includes the fields below. Save the full `name`, including the model path and `operations/`, rather than only its final ID segment.

```json theme={"system"}
{
  "name": "models/doubao-seedance-2-5-260628/operations/task_example",
  "done": false
}
```

After saving the task identifier, [poll the task](/en/api/video-gemini-get).

## Inputs and parameters

Omitted controls default to 5 seconds, 720p, `adaptive` aspect ratio and audio enabled. First/last frames and reference images are separate input modes; do not combine them in the same `instances[0]`.

Example image object:

```json theme={"system"}
{"bytesBase64Encoded": "<BASE64_IMAGE>", "mimeType": "image/png"}
```

See [Video models and pricing](/en/api/video-models) for model limits. Arbitrary `gs://` inputs, video extension and the full Veo parameter set are not supported. Use [Ark / Seedance](/en/api/video-ark) for reference audio, reference video or video editing.

<Accordion title="Complete SDK example">
  Install `google-genai` and set `AIOHUB_API_KEY` in your environment. This example uses Gemini API mode. The base URL excludes `/v1beta`; set the version with `api_version`.

  ```python Python theme={"system"}
  import os
  import time
  from google import genai
  from google.genai import types

  client = genai.Client(
      api_key=os.environ["AIOHUB_API_KEY"],
      http_options=types.HttpOptions(base_url="https://api.aiohub.org", api_version="v1beta"),
  )
  op = client.models.generate_videos(
      model="doubao-seedance-2-0-260128-libtv",
      source=types.GenerateVideosSource(prompt="A blue ceramic cup on a wooden table."),
      config=types.GenerateVideosConfig(
          number_of_videos=1, duration_seconds=4, aspect_ratio="16:9", resolution="720p"
      ),
  )
  while not op.done:
      time.sleep(15)
      op = client.operations.get(op)
  if op.error:
      raise RuntimeError(str(op.error))
  video = op.response.generated_videos[0].video
  with open("video.mp4", "wb") as f:
      f.write(client.files.download(file=video))
  ```
</Accordion>

<Note>If creation times out without a task identifier, check the [usage log](https://api.aiohub.org/console/log) before resubmitting to avoid duplicate generation and charges. Correct parameters after a 400 and check the API key after a 401. See [Authentication](/en/api/authentication) for access and quota requirements.</Note>


## OpenAPI

````yaml openapi/relay.en.json POST /v1beta/models/{model}:predictLongRunning
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub public API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: List models
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: Image generation
  - name: OpenAI Images
  - name: Video generation
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: Text completions
  - name: OpenAI Audio
  - name: Realtime API
paths:
  /v1beta/models/{model}:predictLongRunning:
    post:
      tags:
        - Video generation
      summary: Create Gemini video task
      description: >
        This page covers the Seedance Gemini video format. See [Models and
        pricing](/en/api/video-models) for model limits.


        Creation returns name and done: false. Save the full name and poll every
        10 to 15 seconds. HTTP 200 does not mean the video is ready.
      operationId: createSeedanceGeminiVideo
      parameters:
        - name: model
          in: path
          required: true
          description: Full Seedance model name.
          schema:
            type: string
            example: doubao-seedance-2-5-260628
          example: doubao-seedance-2-5-260628
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SeedanceGoogleVideoRequest'
            examples:
              text:
                summary: Text to video
                value:
                  instances:
                    - prompt: A blue ceramic cup on a wooden table in daylight.
                  parameters:
                    durationSeconds: 4
                    aspectRatio: '16:9'
                    resolution: 720p
                    generateAudio: true
                    sampleCount: 1
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGeminiOperation'
              example:
                name: models/doubao-seedance-2-5-260628/operations/task_example
                done: false
        '400':
          description: >-
            Invalid fields, types or model capability. Correct the request using
            code and message before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
        '401':
          description: Missing or invalid API key.
        '429':
          description: Too many requests or capacity exhausted; wait before retrying.
        '503':
          description: >-
            Model unavailable in the selected group, or service temporarily
            unavailable.
      security:
        - BearerAuth: []
components:
  schemas:
    SeedanceGoogleVideoRequest:
      type: object
      properties:
        instances:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Send exactly one instance. Text generation requires prompt; use
            image for a first frame.
          items:
            type: object
            properties:
              prompt:
                type: string
                description: Text prompt, required for text-only generation.
              image:
                $ref: '#/components/schemas/SeedanceGoogleImage'
              lastFrame:
                $ref: '#/components/schemas/SeedanceGoogleImage'
              referenceImages:
                type: array
                minItems: 1
                maxItems: 30
                items:
                  $ref: '#/components/schemas/SeedanceGoogleReferenceImage'
                description: >-
                  Up to 30 images for 2.5 or 9 for the 2.0 family. Cannot be
                  combined with image or lastFrame.
        parameters:
          type: object
          properties:
            durationSeconds:
              type: integer
              minimum: 4
              maximum: 30
              default: 5
              description: 'Whole seconds: 4 to 30 for 2.5, 4 to 15 for the 2.0 family.'
            aspectRatio:
              type: string
              description: >-
                Defaults to adaptive. Seedance 2.5 first/last-frame input
                requires adaptive.
              enum:
                - adaptive
                - '16:9'
                - '4:3'
                - '1:1'
                - '3:4'
                - '9:16'
                - '21:9'
              default: adaptive
            resolution:
              type: string
              description: >-
                Model-dependent. 4k is available only on standard 2.0; fast/mini
                do not support 1080p.
              enum:
                - 480p
                - 720p
                - 1080p
                - 4k
              default: 720p
            generateAudio:
              type: boolean
              default: true
              description: Whether to generate audio.
            sampleCount:
              type: integer
              enum:
                - 1
              default: 1
              description: Each task generates one video.
            numberOfVideos:
              type: integer
              enum:
                - 1
              description: Alias for sampleCount; must be 1 when supplied.
      required:
        - instances
      description: >-
        This schema covers Seedance. lastFrame requires image; reference images
        cannot be combined with first/last frames. Video extension, masks, seed,
        negativePrompt and other unlisted controls are unsupported.
    SeedanceGeminiOperation:
      type: object
      properties:
        name:
          type: string
          description: Full operation name. Save the returned value for polling.
        done:
          type: boolean
          description: >-
            False means pending. True means finished, possibly with a failure;
            check error.
        response:
          type: object
          properties:
            '@type':
              type: string
              description: Response type.
            generateVideoResponse:
              type: object
              properties:
                generatedSamples:
                  type: array
                  items:
                    type: object
                    properties:
                      video:
                        type: object
                        properties:
                          uri:
                            type: string
                            description: >-
                              Full HTTPS file download URL returned on success;
                              authentication is required.
                            format: uri
                        required:
                          - uri
                    required:
                      - video
        error:
          type: object
          properties:
            message:
              type: string
              description: Generation failure reason.
          required:
            - message
      required:
        - name
        - done
    SeedanceTaskError:
      type: object
      description: Error response of the video task endpoints.
      properties:
        code:
          type: string
          description: Error code
          example: invalid_duration
        message:
          type: string
          description: Error message
          example: duration must be between 4 and 30 seconds for this model
    SeedanceGoogleImage:
      type: object
      properties:
        bytesBase64Encoded:
          type: string
          description: Base64 image bytes without a data URL prefix.
        mimeType:
          type: string
          description: Image MIME type, such as image/png or image/jpeg.
          example: image/png
      required:
        - bytesBase64Encoded
        - mimeType
    SeedanceGoogleReferenceImage:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/SeedanceGoogleImage'
        referenceType:
          type: string
          description: Use asset. Do not combine references with first/last-frame inputs.
          enum:
            - asset
          default: asset
      required:
        - image
        - referenceType
  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.