Skip to content

Create a video task · cogvideo-pro ​

POST/v1/videos

Create one asynchronous task. Fixed per-video billing; failed tasks are refunded. Do not re-submit after a client timeout without checking the existing task.

Asynchronous · submit and query · Returns a task ID. Query its status in the playground, then retrieve the result.

Authentication

Use a customer API Key. Setup →

Authorization: Bearer YOUR_API_KEY

Choose a model

Model capabilities and limits →

Request body

Conflicting aliases/metadata are rejected. Single-image and reference-image inputs are mutually exclusive. For reference mode use fast/pro and 3–10 seconds.

Input and model rules
  • Cannot combine input_reference, image_url.
  • When model = "cogvideo-basic": seconds: 1–5 or ^[1-5]$; duration: 1–5 or ^[1-5]$; must not reference_images is present; must not metadata is present and metadata.reference_images is present.
  • When model = "cogvideo-short": seconds accepts only 8, "8"; duration accepts only 8, "8"; size must be "720x1280"; resolution must be "720p"; aspect_ratio must be "9:16"; must not input_reference is present; must not image_url is present; must not reference_images is present; must not metadata is present and metadata.reference_images is present; otherwise size accepts only "1920x1080", "1080x1920", "1080x1080", "1440x1080", "1080x1440"; resolution must be "1080p".
modelstringrequired

"cogvideo-fast""cogvideo-pro""cogvideo-basic""cogvideo-short"
promptstringrequired

Non-blank prompt, at most 4096 Unicode characters.

Minimum characters: 1 · Maximum characters: 4096 · Pattern: "\\S"

secondsoneOf

Defaults: fast/pro/basic=5; short=8. Basic maximum 5; reference mode minimum 3; short exactly 8.

Show structure
oneOf · 1

integer

Minimum: 1 · Maximum: 10

oneOf · 2

string

Pattern: "^(10|[1-9])$"

durationoneOf

Defaults: fast/pro/basic=5; short=8. Basic maximum 5; reference mode minimum 3; short exactly 8.

Show structure
oneOf · 1

integer

Minimum: 1 · Maximum: 10

oneOf · 2

string

Pattern: "^(10|[1-9])$"

sizestring

fast/pro/basic: 1080p sizes only; short: 720x1280 only. Actual encoding dimensions are read from the file.

"1920x1080""1080x1920""1080x1080""1440x1080""1080x1440""720x1280"
resolutionstring

"1080p""720p"
aspect_ratiostring

"16:9""9:16""1:1""4:3""3:4"
input_referencestring

HTTP(S) image URL or Base64 image data URL.

Pattern: "^(https?://|data:image/)"

image_urlstring

HTTP(S) image URL or Base64 image data URL.

Pattern: "^(https?://|data:image/)"

reference_imagesarray

Minimum items: 1

Show structure

string — HTTP(S) image URL or Base64 image data URL.

Pattern: "^(https?://|data:image/)"

generation_modestring

"speed""pro""pro_ad"
metadataobject

Show structure
modestring

Must match supplied images.

"text_to_video""image_to_video""reference_to_video"
resolutionstring
"1080p""720p"
aspect_ratiostring
"16:9""9:16""1:1""4:3""3:4"
reference_imagesarray

Minimum items: 1

Show structure

string — HTTP(S) image URL or Base64 image data URL.

Pattern: "^(https?://|data:image/)"

generation_modestring

Reference mode only.

"speed""pro""pro_ad"

Default: "pro_ad"

Additional properties are not allowed.

ninteger

Fixed value: 1 · Default: 1

sample_countinteger

Fixed value: 1 · Default: 1

allOf · 1
Input and model rules
  • Cannot combine input_reference, image_url.

object

Conditional constraints (JSON Schema)
{
  "not": {
    "required": [
      "input_reference",
      "image_url"
    ]
  }
}
allOf · 2
Input and model rules
  • When model = "cogvideo-basic": seconds: 1–5 or ^[1-5]$; duration: 1–5 or ^[1-5]$; must not reference_images is present; must not metadata is present and metadata.reference_images is present.

object

Conditional constraints (JSON Schema)
{
  "if": {
    "properties": {
      "model": {
        "const": "cogvideo-basic",
        "type": "string"
      }
    }
  },
  "then": {
    "properties": {
      "seconds": {
        "oneOf": [
          {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          {
            "type": "string",
            "pattern": "^[1-5]$"
          }
        ]
      },
      "duration": {
        "oneOf": [
          {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          {
            "type": "string",
            "pattern": "^[1-5]$"
          }
        ]
      }
    },
    "not": {
      "anyOf": [
        {
          "required": [
            "reference_images"
          ]
        },
        {
          "required": [
            "metadata"
          ],
          "properties": {
            "metadata": {
              "required": [
                "reference_images"
              ]
            }
          }
        }
      ]
    }
  }
}
allOf · 3
Input and model rules
  • When model = "cogvideo-short": seconds accepts only 8, "8"; duration accepts only 8, "8"; size must be "720x1280"; resolution must be "720p"; aspect_ratio must be "9:16"; must not input_reference is present; must not image_url is present; must not reference_images is present; must not metadata is present and metadata.reference_images is present; otherwise size accepts only "1920x1080", "1080x1920", "1080x1080", "1440x1080", "1080x1440"; resolution must be "1080p".

object

Conditional constraints (JSON Schema)
{
  "if": {
    "properties": {
      "model": {
        "const": "cogvideo-short",
        "type": "string"
      }
    }
  },
  "then": {
    "properties": {
      "seconds": {
        "enum": [
          8,
          "8"
        ]
      },
      "duration": {
        "enum": [
          8,
          "8"
        ]
      },
      "size": {
        "const": "720x1280",
        "type": "string"
      },
      "resolution": {
        "const": "720p",
        "type": "string"
      },
      "aspect_ratio": {
        "const": "9:16",
        "type": "string"
      }
    },
    "not": {
      "anyOf": [
        {
          "required": [
            "input_reference"
          ]
        },
        {
          "required": [
            "image_url"
          ]
        },
        {
          "required": [
            "reference_images"
          ]
        },
        {
          "required": [
            "metadata"
          ],
          "properties": {
            "metadata": {
              "required": [
                "reference_images"
              ]
            }
          }
        }
      ]
    }
  },
  "else": {
    "properties": {
      "size": {
        "enum": [
          "1920x1080",
          "1080x1920",
          "1080x1080",
          "1440x1080",
          "1080x1440"
        ],
        "type": "string"
      },
      "resolution": {
        "const": "1080p",
        "type": "string"
      }
    }
  }
}

Additional properties are not allowed.

Responses

Task accepted. Save id and poll; task status determines eventual success.

Content-Type application/json

idstringrequired
objectstringrequired

Fixed value: "video"

statusstringrequired

unknown means an unrecognized task state; do not interpret as completion.

"queued""in_progress""completed""failed""unknown"
progressnumberrequired
created_atintegerrequired
errorobject
Show structure
codestring

Fixed value: "video_generation_failed"

messagestring

Task status and results