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

# Create Wan video task

> Generate videos with Wan 3.0 and Wan 3.0 Prime.

## Request parameters

| Field | Values and defaults |
| - | - |
| `model` | Required: `wan-3.0` or `wan-3.0-prime` |
| `prompt` | Required, nonempty text, at most 12,000 characters |
| `mode` | `text_to_video`, `image_to_video`, `reference_to_video`; inferred from assets when omitted |
| `controls.duration` | Integer 2–30 seconds; default 5. With video input, total input video duration plus output duration must not exceed 30 seconds |
| `controls.resolution` | `480p`, `720p`, `1080p`; default `1080p` |
| `controls.ratio` | `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `adaptive`; default `adaptive` |
| `controls.generateAudio` | Boolean; default `true` |
| `controls.seed` | Integer 0–2147483647; omit or use 0 for random generation |
| `providerOptions.wan.prompt_extend` | Boolean; default `false` |

## Image to video

Set `mode: "image_to_video"` and add a required first frame and optional last frame:

```json theme={"dark"}
{
  "model": "wan-3.0-prime",
  "mode": "image_to_video",
  "prompt": "The camera gently moves toward the product.",
  "assets": {
    "firstFrameImage": "https://example.com/first.jpg",
    "lastFrameImage": "https://example.com/last.jpg"
  },
  "controls": { "duration": 5, "resolution": "720p" }
}
```

All media inputs must be HTTPS URLs accessible for generation. Inline Base64 and asset IDs are unsupported on this API.

## Reference to video

Use `mode: "reference_to_video"` with any combination of the reference arrays. Reference media are optional in this mode.

```json theme={"dark"}
{
  "model": "wan-3.0",
  "mode": "reference_to_video",
  "prompt": "Recreate the subject in a cinematic scene using the reference motion.",
  "assets": {
    "referenceImages": ["https://example.com/subject.jpg"],
    "referenceVideos": ["https://example.com/motion.mp4"],
    "referenceAudios": ["https://example.com/sound.mp3"]
  },
  "controls": { "duration": 8, "resolution": "720p", "generateAudio": true },
  "providerOptions": { "wan": { "prompt_extend": true } }
}
```

| Reference | Limit |
| - | - |
| `assets.referenceImages` | Up to 10 JPG/JPEG, PNG (no transparency), BMP or WEBP images; at most 20 MB each; each side 240–8000 pixels; long-to-short-side ratio at most 8:1 |
| `assets.referenceVideos` | Up to 5 MP4/MOV videos, each 1–15 seconds, at most 15 seconds combined; up to 100 MB each; at least 16 fps; each side 240–4096 pixels; long-to-short-side ratio at most 8:1 |
| `assets.referenceAudios` | Up to 5 WAV or MP3 files, 1–15 seconds each, at most 15 seconds combined; up to 15 MB each |
| `providerOptions.wan.referenceDocument` | One HTTPS document URL: DOCX, XLSX, PPTX, PDF or Markdown; up to 100 MB and 50 pages |
| `providerOptions.wan.referencePage` | One HTTPS public web page URL |

When reference videos are supplied, **total input video duration + output video duration must not exceed 30 seconds**. For example, 15 seconds of reference video allows at most 15 seconds of output; 10 seconds of reference video allows at most 20 seconds of output. Without video input, output may be up to 30 seconds. Audio duration does not count toward this video limit.

Media limits apply to the actual media, including remotely hosted URLs. The generation service validates media and returns its specific rejection reason. GENGEN does not download inputs to inspect their duration. Use at most 20 reference materials in total.

A document or page automatically enables prompt rewriting. Use either a document or a page in one request.
Frames cannot be combined with reference arrays. Unknown asset, control and Wan option fields are rejected.

## Response and billing

```json theme={"dark"}
{
  "id": "wan30:12345678-1234-4234-8234-123456789abc",
  "model": "wan-3.0",
  "status": "pending",
  "outputs": { "videos": [], "images": [] },
  "createdAt": "2026-10-23T08:00:00.000Z"
}
```

Prime task IDs begin with `wan30prime:`. Save the returned ID and [retrieve the task](https://docs.gengen.farm/api-reference/wan/standard/video-generation/retrieve-task.md).
If acceptance is still being reconciled, keep polling the same ID. Do not submit a new generation to check progress.

The wallet reserves the estimated cost before submission. Successful tasks are charged for provider-reported output video seconds plus the combined reference video seconds, using the model, resolution and price fixed when submitted. Images and audio references do not add video seconds. See [Pricing](https://docs.gengen.farm/pricing.md) for current customer prices. Failed and confirmed cancelled tasks release their reservation; pending tasks remain reserved. Repeat queries do not charge again.

Invalid fields or incompatible modes return HTTP 400, insufficient balance returns 402, and temporary unavailability returns 503. Retrieve and cancel require the API key scope that owns the task.

HTTP failures include `error_code` and an `error` message. When the provider gives a specific rejection reason, the message preserves that reason after redacting credentials. A successfully accepted task can still fail later; inspect `failureReason` when retrieving a failed task.

Reference-video requests reserve up to `min(output seconds + 15, 30)` seconds of fees without downloading or probing the input. Final billing uses the provider-reported input-plus-output video seconds; unused reservation is released. Media validity is checked by the generation service.

Rate-limit rejections are returned without automatic queuing or retry. Error responses retain the upstream error code, message and supplementary diagnostic details, with credentials redacted. An uncertain submission is never automatically submitted again.

For pending tasks, poll the returned ID. The successful task detail includes `usage` with billable seconds and the applicable price row. See [usage fields](https://docs.gengen.farm/api-reference/wan/standard/video-generation/retrieve-task.md#usage).


## OpenAPI

````yaml openapi/wan-standard-video.yaml POST /contents/generations/tasks
openapi: 3.1.0
info:
  title: Wan Standard Video API
  version: 1.0.0
  description: >-
    Wan 3.0 and Wan 3.0 Prime video generation. Charged by provider-reported
    output seconds plus input reference video seconds, using the frozen customer
    rate.
servers:
  - url: https://gengen.farm/api/gengen/v1
security:
  - bearerAuth: []
paths:
  /contents/generations/tasks:
    post:
      summary: Create Wan Standard video task
      operationId: createWanStandardVideoTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WanRequest'
            example:
              model: wan-3.0
              mode: text_to_video
              prompt: A cinematic coastal landscape at sunrise.
              controls:
                duration: 5
                resolution: 1080p
                ratio: '16:9'
                generateAudio: true
      responses:
        '200':
          description: Accepted. Save the public task ID and poll it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WanTask'
              example:
                id: wan30:12345678-1234-4234-8234-123456789abc
                model: wan-3.0
                status: pending
                outputs:
                  videos: []
                  images: []
        '400':
          description: Invalid request or incompatible media/mode.
        '401':
          description: Invalid API key.
        '402':
          description: Insufficient balance.
        '404':
          description: Task not found in this API key scope.
        '409':
          description: Cancellation is not confirmed or parameters changed during retry.
        '429':
          description: Rate limited.
        '502':
          description: Task outcome could not be confirmed.
        '503':
          description: Generation temporarily unavailable.
components:
  schemas:
    WanRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          enum:
            - wan-3.0
            - wan-3.0-prime
        mode:
          type: string
          enum:
            - text_to_video
            - image_to_video
            - reference_to_video
          description: >-
            Inferred from assets when omitted. Frames require image_to_video;
            reference arrays/document/page require reference_to_video.
        prompt:
          type: string
          minLength: 1
          maxLength: 12000
        assets:
          type: object
          additionalProperties: false
          properties:
            firstFrameImage:
              type: string
              format: uri
              pattern: ^https://
              maxLength: 4096
            lastFrameImage:
              type: string
              format: uri
              pattern: ^https://
              maxLength: 4096
            referenceImages:
              type: array
              maxItems: 10
              items:
                type: string
                format: uri
                pattern: ^https://
                maxLength: 4096
            referenceVideos:
              type: array
              maxItems: 5
              items:
                type: string
                format: uri
                pattern: ^https://
                maxLength: 4096
              description: >-
                MP4 or MOV; each 1–15 seconds, at most 15 seconds combined; at
                least 16 fps; each side 240–4096 pixels; long-to-short-side
                ratio at most 8 to 1; at most 100 MB per file. Total input video
                duration plus output duration must not exceed 30 seconds.
            referenceAudios:
              type: array
              maxItems: 5
              items:
                type: string
                format: uri
                pattern: ^https://
                maxLength: 4096
              description: >-
                WAV or MP3; 1–15 seconds each, at most 15 seconds combined and
                15 MB per file.
        controls:
          type: object
          additionalProperties: false
          properties:
            duration:
              type: integer
              minimum: 2
              maximum: 30
              default: 5
              description: >-
                Output duration in seconds. With video input, total reference
                video duration plus this duration must not exceed 30 seconds.
            resolution:
              type: string
              enum:
                - 480p
                - 720p
                - 1080p
              default: 1080p
            ratio:
              type: string
              enum:
                - '16:9'
                - '4:3'
                - '1:1'
                - '3:4'
                - '9:16'
                - adaptive
              default: adaptive
            generateAudio:
              type: boolean
              default: true
            seed:
              type: integer
              minimum: 0
              maximum: 2147483647
        providerOptions:
          type: object
          additionalProperties: false
          properties:
            wan:
              type: object
              additionalProperties: false
              properties:
                prompt_extend:
                  type: boolean
                  default: false
                referenceDocument:
                  type: string
                  format: uri
                  pattern: ^https://
                  maxLength: 4096
                  description: >-
                    DOCX, XLSX, PPTX, PDF or MD. Enables prompt rewriting;
                    mutually exclusive with referencePage.
                referencePage:
                  type: string
                  format: uri
                  pattern: ^https://
                  maxLength: 4096
                  description: >-
                    Public web page. Enables prompt rewriting; mutually
                    exclusive with referenceDocument.
      allOf:
        - if:
            properties:
              mode:
                const: image_to_video
            required:
              - mode
          then:
            required:
              - assets
            properties:
              assets:
                required:
                  - firstFrameImage
    WanTask:
      type: object
      required:
        - id
        - model
        - status
        - outputs
      properties:
        id:
          type: string
          pattern: ^wan30(prime)?:[0-9a-f-]{36}$
        model:
          type: string
          enum:
            - wan-3.0
            - wan-3.0-prime
        status:
          type: string
          enum:
            - pending
            - processing
            - succeeded
            - failed
            - cancelled
        outputs:
          type: object
          required:
            - videos
            - images
          properties:
            videos:
              type: array
              items:
                type: string
                format: uri
            expiresAt:
              type: string
              format: date-time
              description: >-
                Fixed expiration of the output URL. Expired video URLs are
                omitted; they cannot be renewed.
            images:
              type: array
              items:
                type: string
        usage:
          type: object
          description: >-
            Successful task detail. Billable seconds include the generated video
            and all reference video inputs.
          required:
            - priceRowId
            - resolution
            - billableSeconds
            - inputVideoDurationSeconds
            - outputDurationSeconds
          properties:
            priceRowId:
              type: string
              description: Stable customer price row in GET /api/public/pricing.
            resolution:
              type: string
              description: Resolution tier used for pricing, such as 720p.
            billableSeconds:
              type: number
              description: Seconds to multiply by the selected per-second rate.
            inputVideoDurationSeconds:
              type: number
              description: Input video seconds used for billing.
            outputDurationSeconds:
              type: number
              description: Output video duration in seconds.
        createdAt:
          type: string
          format: date-time
        failureReason:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.