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

# Get video · Gemini API

> Check task status, handle failures and find the completed video.

## Polling and status

Replace `<OPERATION_NAME>` with the full `name` from creation and poll every 10 to 15 seconds:

```bash theme={"system"}
curl "https://api.aiohub.org/v1beta/<OPERATION_NAME>" \
  -H "Authorization: Bearer <AIOHUB_API_KEY>"
```

| Response | Action |
| - | - |
| `done: false` | Keep polling |
| `done: true` with `response` | Download the video |
| `done: true` with `error` | Stop polling and read `error.message` |

`done: true` means the operation ended, not necessarily that it succeeded.

## Read a successful result

Key fields in a successful response:

```json theme={"system"}
{
  "name": "models/doubao-seedance-2-5-260628/operations/task_example",
  "done": true,
  "response": {
    "generateVideoResponse": {
      "generatedSamples": [
        {
          "video": {
            "uri": "https://api.aiohub.org/v1beta/files/<FILE_NAME>:download?alt=media"
          }
        }
      ]
    }
  }
}
```

After success, [download the video](/en/api/video-gemini-download).

## Failures and retries

After a polling disconnect, keep polling the same `name` rather than calling `predictLongRunning` again. Correct fields before retrying a 400. If a terminal operation has `error`, do not read the success response fields. Files remain for 72 hours and task records for 7 days.

After a 429 or temporary service error, wait before retrying the read; do not create another task. If a task is missing, check the identifier and the account that owns the API key.


## OpenAPI

````yaml openapi/relay.en.json GET /v1beta/models/{model}/operations/{operation}
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}/operations/{operation}:
    get:
      tags:
        - Video generation
      summary: Get Gemini video task
      description: >
        Keep polling while done is false. When done is true, check error first;
        read error.message on failure and response on success. Task records
        remain readable for 7 days.


        Download using the full
        response.generateVideoResponse.generatedSamples[0].video.uri.
      operationId: getSeedanceGeminiVideo
      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
        - name: operation
          in: path
          required: true
          description: >-
            The identifier after operations/ in the returned name, not the full
            name.
          schema:
            type: string
            example: task_example
          example: task_example
      responses:
        '200':
          description: Current task state; generation failures can also return HTTP 200.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceGeminiOperation'
              examples:
                pending:
                  summary: Pending
                  value:
                    name: models/doubao-seedance-2-5-260628/operations/task_example
                    done: false
                succeeded:
                  summary: Succeeded
                  value:
                    name: models/doubao-seedance-2-5-260628/operations/task_example
                    done: true
                    response:
                      generateVideoResponse:
                        generatedSamples:
                          - video:
                              uri: >-
                                https://api.aiohub.org/v1beta/files/7461736b5f6578616d706c65:download?alt=media
                failed:
                  summary: Failed
                  value:
                    name: models/doubao-seedance-2-5-260628/operations/task_example
                    done: true
                    error:
                      message: Video generation failed
        '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.
        '404':
          description: Task not found or not owned by this account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
      security:
        - BearerAuth: []
components:
  schemas:
    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
  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.