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

# Vidu Template API

> Generate videos with Vidu effect templates through the unified Crun task endpoint. The input object keeps the same field structure as the official Vidu template API.

## Overview

Use this endpoint to generate a video with a specific Vidu effect template through Crun's unified task creation API.

The `input` object is aligned with the official Vidu template request structure, while the outer wrapper follows the Crun unified task format:

```json theme={null}
{
  "model": "vidu/template",
  "input": {
    "template": "Easter_cute_pets",
    "images": [
      "https://static.crunai.com/u/9b4262e8-4051-4ae8-abf8-e8d8955a948c.png"
    ],
    "bgm": true
  }
}
```

<Tip>
  To integrate all available Vidu templates at once, first call the Vidu template list endpoint at <code>/api/v1/client/job/vidu-templates</code>, then dynamically render template metadata and submit the selected template to this generation endpoint.
</Tip>

## Template Discovery

Before creating a task, developers can fetch the latest template catalog from the Crun Vidu template list endpoint:

<Card title="Vidu Template List" icon="list" href="/templates/vidu/template-list">
  Query all available Vidu effect templates, supported options, cover assets, and per-template instructions.
</Card>

The list endpoint makes it easy to build a one-click integration flow for all templates:

1. Query `/api/v1/client/job/vidu-templates`
2. Display the returned template list in your app
3. Use the selected `template` value and supported fields to call `vidu/template`

## Official References

* Official Vidu template gallery examples: [Templates](https://platform.vidu.com/docs/templates)
* Official Vidu template generation API: [Template](https://platform.vidu.com/docs/template)

## Query Task Status

After submitting a task, use the unified query endpoint to check progress and retrieve results:

<Card title="Get Task Info" icon="magnifying-glass" href="/models/common/get-task-info">
  Learn how to query task status and retrieve generation results
</Card>

<Tip>
  For production use, we recommend using the `callback_url` parameter to receive automatic notifications when generation completes, rather than polling the status endpoint.
</Tip>

## Related Resources

<CardGroup cols={2}>
  <Card title="Vidu Template List" icon="list" href="/templates/vidu/template-list">
    Query all available Vidu effect templates and support one-click template integration.
  </Card>

  <Card title="Models Overview" icon="store" href="/models/quickstart">
    Explore all available generation models on Crun.
  </Card>
</CardGroup>


## OpenAPI

````yaml templates/vidu-template.json post /api/v1/client/job/CreateTask
openapi: 3.0.0
info:
  title: Crun Vidu Template Video Generation API
  description: crun.ai Vidu template video generation API documentation
  version: 1.0.0
  contact:
    name: Technical Support
    email: support@crun.ai
servers:
  - url: https://api.crun.ai
    description: API Server
security:
  - ApiKeyAuth: []
paths:
  /api/v1/client/job/CreateTask:
    post:
      summary: Generate video with a Vidu effect template
      operationId: vidu-template-video-generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  enum:
                    - vidu/template
                  description: |-
                    The model name to use for generation. Required field.

                    - Must be `vidu/template` for this endpoint
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. Callback URL for receiving task completion
                    notifications.


                    - System will POST task status and results to this URL when
                    generation completes

                    - Callback payloads structure is consistent with the `data`
                    object returned by the task status query

                    - Your callback endpoint should accept POST requests with
                    JSON payload containing results

                    - It returns an HTTP 200 status code upon successful receipt
                  example: https://your-domain.com/api/callback
                input:
                  type: object
                  description: >-
                    Input parameters for Vidu template video generation. The
                    field structure is aligned with the official Vidu template
                    API, while the outer request follows the Crun unified task
                    format.
                  required:
                    - template
                    - images
                  properties:
                    template:
                      type: string
                      description: >-
                        Template identifier. You can query supported template
                        IDs through `/api/v1/client/job/vidu-templates`.
                      example: Easter_cute_pets
                    images:
                      type: array
                      description: >-
                        Template input images. The actual supported image count
                        depends on the selected template. Refer to the template
                        list response and official Vidu examples for each
                        template's input requirements.
                      items:
                        type: string
                      minItems: 1
                      example:
                        - >-
                          https://static.crunai.com/u/9b4262e8-4051-4ae8-abf8-e8d8955a948c.png
                    prompt:
                      type: string
                      nullable: true
                      maxLength: 2000
                      description: >-
                        Optional text prompt. Some templates do not require this
                        field.
                      example: A warm spring memory with cute pets.
                    aspect_ratio:
                      type: string
                      nullable: true
                      description: >-
                        Optional output aspect ratio. Availability depends on
                        the selected template.
                      example: '9:16'
                    area:
                      type: string
                      nullable: true
                      description: >-
                        Optional style control field used by some templates,
                        such as region-specific variants.
                      example: japan
                    beast:
                      type: string
                      nullable: true
                      description: >-
                        Optional style control field used by some templates,
                        such as animal companion variants.
                      example: tiger
                    bgm:
                      type: boolean
                      nullable: true
                      description: Whether to add background music.
                      example: true
                    story:
                      type: string
                      nullable: true
                      description: >-
                        Optional story template field for templates that support
                        story-based generation.
                      example: romantic_confession
            example:
              model: vidu/template
              input:
                template: Easter_cute_pets
                images:
                  - >-
                    https://static.crunai.com/u/9b4262e8-4051-4ae8-abf8-e8d8955a948c.png
                bgm: true
      responses:
        '200':
          description: Request successful
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          task_id:
                            type: string
                            description: >-
                              Task ID, can be used with Get Task Details
                              endpoint to query task status
                            example: task_12345678
              example:
                code: 200
                message: success
                data:
                  task_id: task_12345678
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      errors:
                        type: array
                        description: Detailed validation error messages
                        items:
                          type: string
                        example:
                          - >-
                            Value error, Invalid input for model vidu/template:
                            images must contain at least 1 item
              example:
                code: 422
                message: Missing Params or Type Error
                errors:
                  - >-
                    Value error, Invalid input for model vidu/template: images
                    must contain at least 1 item
        '500':
          $ref: '#/components/responses/Error'
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          enum:
            - 200
            - 401
            - 402
            - 404
            - 422
            - 429
            - 455
            - 500
            - 501
            - 505
          description: >-
            Response status code


            - **200**: Success - Request has been processed successfully

            - **401**: Unauthorized - Authentication credentials are missing or
            invalid

            - **402**: Insufficient Credits - Account does not have enough
            credits to perform the operation

            - **404**: Not Found - The requested resource or endpoint does not
            exist

            - **422**: Validation Error - The request parameters failed
            validation checks

            - **429**: Rate Limited - Request limit has been exceeded for this
            resource

            - **455**: Service Unavailable - System is currently undergoing
            maintenance

            - **500**: Server Error - An unexpected error occurred while
            processing the request

            - **501**: Generation Failed - Content generation task failed

            - **505**: Feature Disabled - The requested feature is currently
            disabled
        message:
          type: string
          description: Response message, error description when failed
          example: success
  responses:
    Error:
      description: Server Error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        All APIs require authentication via API Key.


        Get API Key:

        1. Visit [API Key Management Page](https://crun.ai/user-api-key) to get
        your API Key


        Usage:

        Add to request header:


        x-api-key: YOUR_API_KEY


        Note:

        - Keep your API Key secure and do not share it with others

        - If you suspect your API Key has been compromised, reset it immediately
        in the management page

````