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

# Create Task

<Note>
  Note: For video model name settings, refer to the [System Supported Video Model List](https://geekai.dev/models), currently supported video generation models are `cogvideox-flash` (free), `cogvideox`, and `cogvideox-2`. The response data format is fully compatible with OpenAI, returning the binary data of the video file.
</Note>

Different AI platforms support different video sizes for their video generation models. Please refer to the table below for the specific supported sizes:

<div style={{ width: '100%', overflowX: 'auto' }}>
  <table style={{ width: '100%', borderCollapse: 'collapse', tableLayout: 'fixed' }}>
    <thead>
      <tr>
        <th style={{ border: '1px solid #ccc', padding: '10px'}}>Platform</th>
        <th style={{ border: '1px solid #ccc', padding: '10px'}}>Model</th>
        <th style={{ border: '1px solid #ccc', padding: '10px', width: '60%'}}>Supported Sizes</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td style={{ border: '1px solid #ccc', padding: '8px' }}>Zhipu</td>
        <td style={{ border: '1px solid #ccc', padding: '8px' }}>CogVideoX Series</td>

        <td style={{ border: '1px solid #ccc', padding: '8px' }}>
          720x480, 1024x1024, 1280x960, 960x1280, 1920x1080,
          1080x1920, 2048x1080, 3840x2160 (By default, the shorter side is 1080, and the longer side is scaled proportionally)
        </td>
      </tr>
    </tbody>
  </table>
</div>

### cURL Request Example

```bash theme={null}
    curl --location 'https://geekai.dev/api/v1/videos/generations' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
    --data '{
        "model":"cogvideox-flash",
        "prompt":"Kittens and puppies are playing in the grass",
        "async": false
    }'
```


## OpenAPI

````yaml openapi.yaml POST /videos/generations
openapi: 3.1.0
info:
  title: 极客智坊 API文档
  description: 极客智坊 API 消息接口规范文档
  version: 1.0.0
servers:
  - url: https://geekai.co/api/v1
    description: 国内代理入口
  - url: https://geekai.dev/api/v1
    description: 海外代理入口
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /videos/generations:
    post:
      tags:
        - Video
      summary: 视频生成接口
      description: 基于文本提示/图片生成视频的接口，支持多种视频生成模型和参数配置。
      operationId: createVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: 视频模型
                  example: cogvideox-flash
                prompt:
                  type: string
                  description: 文本提示
                  example: 彼得兔开小汽车，游走在马路上，脸上的表情充满开心喜悦
                negative_prompt:
                  type: string
                  description: 反向提示词，用来描述不希望在视频中看到的内容，可以对视频进行限制，仅支持该字段模型生效
                image:
                  oneOf:
                    - type: string
                      description: 视频首帧图片URL
                    - type: array
                      description: 参考图片URL（仅适用于旧模型，新模型采用images字段替代，具体以模型示例文档为准）
                      items:
                        type: string
                image_tail:
                  type: string
                  description: 用于视频尾帧的图片URL，仅支持该字段模型生效
                images:
                  type: array
                  description: 参考图片URL
                  items:
                    type: string
                video:
                  oneOf:
                    - type: string
                      description: 待编辑视频URL
                    - type: array
                      description: 参考视频URL
                      items:
                        type: string
                audio:
                  oneOf:
                    - type: string
                      description: 音频URL
                    - type: array
                      description: 参考音频URL
                      items:
                        type: string
                with_audio:
                  type: boolean
                  description: 是否带音效，仅支持音效的模型生效
                  default: false
                size:
                  type: string
                  description: >-
                    视频尺寸，尺寸越大价格可能越高，不同平台支持的尺寸参数不同，请参考[创建视频API](https://docs.geekai.co/cn/api/video/generations)设置
                  example: 720x720
                resolution:
                  type: string
                  description: >-
                    视频分辨率，不同平台支持的分辨率参数不同，请参考[创建视频API](https://docs.geekai.co/cn/api/video/generations)设置
                  example: 720p
                aspect_ratio:
                  type: string
                  description: 视频宽高比，默认为16:9，仅支持该字段模型生效
                  example: '16:9'
                quality:
                  type: string
                  description: >-
                    视频质量，仅支持该字段模型生效，智谱清言支持 speed、quality 两个配置，可灵 AI 和 Google
                    Veo3 支持 std、pro 两个配置，默认 std，kling-v3 开始支持 4k
                  example: speed
                duration:
                  type: integer
                  description: 视频时长(秒)，默认5秒(海螺默认6s）
                  default: 5
                fps:
                  type: integer
                  description: 视频帧率，仅支持该字段模型生效
                  enum:
                    - 24
                    - 30
                    - 60
                  default: 30
                watermark:
                  type: boolean
                  description: 是否添加AI生成水印，默认为false，仅支持该字段模型生效
                  default: false
                async:
                  type: boolean
                  description: >-
                    是否异步生成，默认false，即同步等待视频生成成功后返回生成结果，如果异步需要通过调用视频获取接口获取生成结果，推荐使用异步
                  default: true
                extra_body:
                  type: object
                  description: 额外参数配置项，以适配不同视频模型的多样化配置
                  properties:
                    draft:
                      type: boolean
                      description: 是否生成样片，仅支持该字段模型生效
                      default: false
                    return_last_frame:
                      type: boolean
                      description: 是否返回最后一帧图片，仅支持该字段模型生效
                      default: false
                    movement_amplitude:
                      type: string
                      description: 运动幅度，仅支持该字段模型生效
                    camera_strength:
                      type: string
                      description: 镜头运动强度，仅支持该字段模型生效
                    image_list:
                      type: array
                      description: 用于视频生成的图片列表，支持图片URL/Base64编码，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          image_url:
                            type: string
                            description: 图片URL/Base64编码数据
                          type:
                            type: string
                            description: 帧类型，first_frame：首帧，end_frame：尾帧
                    video_list:
                      type: array
                      description: 用于视频生成的视频列表，支持视频URL，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          video_url:
                            type: string
                            description: 参考视频URL
                          refer_type:
                            type: string
                            description: 参考类型：feature（特征参考视频）或 base（待编辑视频）
                          keep_original_sound:
                            type: string
                            description: 是否保留原始音频，yes 保留，no 不保留
                    element_list:
                      type: array
                      description: 参考主体列表，基于主体库中主体的 ID 配置，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          element_id:
                            type: long
                            description: 主体ID
                    voice_list:
                      type: array
                      description: 生成视频时所引用的音色的列表，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          voice_id:
                            type: string
                            description: 音色ID
                    multi_shot:
                      type: boolean
                      description: 是否开启多镜头模式，仅支持该字段模型生效
                    shot_type:
                      type: string
                      description: 分镜方式，仅支持该字段模型生效
                    multi_prompt:
                      type: array
                      description: 多镜头模式下的分镜提示词列表，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          index:
                            type: integer
                            description: 分镜索引，从0开始
                          prompt:
                            type: string
                            description: 分镜提示词
                          duration:
                            type: string
                            description: 分镜时长(秒)
                    camera_control:
                      type: object
                      description: 镜头控制，仅支持该字段模型生效
                      properties:
                        type:
                          type: string
                          description: 预定义的运镜类型
                        config:
                          type: object
                          description: 运镜类型的配置参数
                          properties:
                            horizontal:
                              type: float
                              description: 水平运镜
                            vertical:
                              type: float
                              description: 垂直运镜
                            pan:
                              type: float
                              description: 平移运镜
                            tilt:
                              type: float
                              description: 俯仰运镜
                            roll:
                              type: float
                              description: 滚动运镜
                            zoom:
                              type: float
                              description: 缩放运镜
                    static_mask:
                      type: string
                      description: 静态笔刷，仅支持该字段模型生效
                    dynamic_masks:
                      type: array
                      description: 动态笔刷，仅支持该字段模型生效
                      items:
                        type: object
                        properties:
                          mask:
                            type: string
                            description: 运动笔刷涂抹的 mask 图片
                          trajectories:
                            type: array
                            description: 运动笔刷的轨迹点列表
                            items:
                              type: object
                              properties:
                                x:
                                  type: number
                                  description: 轨迹点的 x 坐标
                                'y':
                                  type: number
                                  description: 轨迹点的 y 坐标
                    real_person_mode:
                      type: boolean
                      description: 是否开启真人模式
                retries:
                  type: integer
                  description: 自动重试次数
                  default: 0
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                required:
                  - model
                  - task_id
                  - task_status
                properties:
                  model:
                    type: string
                    description: 使用的视频模型
                    example: cogvideox-flash
                  task_id:
                    type: string
                    description: 任务ID
                    format: uuid
                  task_status:
                    type: string
                    description: 任务状态
                    enum:
                      - pending
                      - running
                      - succeed
                      - failed
                    example: running
                  video_result:
                    type: object
                    description: 视频生成结果(仅在同步模式且生成成功时返回)
                    properties:
                      id:
                        type: string
                        description: 视频ID
                      url:
                        type: string
                        format: uri
                        description: 视频URL
                      cover_image_url:
                        type: string
                        format: uri
                        description: 封面图片URL
                      duration:
                        type: number
                        description: 实际视频时长(秒)
                      revised_prompt:
                        type: string
                        description: 增强后的提示文本
                  error:
                    type: object
                    description: 错误信息(仅在生成失败时返回)
                    properties:
                      code:
                        type: string
                        description: 错误代码
                      message:
                        type: string
                        description: 错误描述
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          description: 提示文本过长或图片过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/StandardError'
components:
  responses:
    ValidationError:
      description: 参数验证错误
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: validation_error
              message:
                type: string
                example: 参数验证失败
              details:
                type: object
                additionalProperties:
                  type: string
                example:
                  field: 错误描述
    Unauthorized:
      description: 未授权
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: Invalid API key or token
    StandardError:
      description: 标准错误响应
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误代码
          example: invalid_request
        message:
          type: string
          description: 错误信息描述
          example: 请求参数不合法
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API认证token
    apiKeyAuth:
      type: apiKey
      in: header
      name: GeekAI-API-Key
      description: API密钥认证

````