# Video Generation

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /grok/v1/videos/generations:
    post:
      summary: Video Generation
      deprecated: false
      description: >-
        ## Overview


        Submit a video generation request using Grok's video model. The request
        is processed asynchronously — the API immediately returns a
        `request_id`, which you can use to poll for the final result.


        ### Generate Videos from Images


        You can optionally provide a source image to animate. The model will
        animate the image content based on your prompt.


        The source image can be provided as:

        - A **public URL** pointing to an image

        - A **base64-encoded data URI** (e.g.,
        `data:image/jpeg;base64,<YOUR_BASE64_IMAGE>`)


        **Example with base64 image:**


        ```json

        {
          "model": "grok-imagine-video",
          "prompt": "Animate the clouds drifting across the sky and add gentle swaying to the trees",
          "image": {"url": "data:image/jpeg;base64,<YOUR_BASE64_IMAGE>"}
        }

        ```


        ### Important Notes


        ⚠️ **Asynchronous Processing**

        This endpoint returns a `request_id` immediately. Use the [Get Video
        Generation
        Results](https://apidoc.cometapi.com/video/sora/official/query) endpoint
        to retrieve the final video once processing is complete.


        ### Reference Documentation


        For detailed parameter reference, see the [xAI Official
        Documentation](https://docs.x.ai/developers/rest-api-reference/inference/videos#post-video-generation).
      tags:
        - 📺 Video Models/XAI
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: '{{api-key}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: |
                    Prompt for video generation.
                aspect_ratio:
                  type: string
                  enum:
                    - '"1:1"'
                    - '"16:9"'
                    - '"9:16"'
                    - '"4:3"'
                    - '"3:4" '
                    - '"3:2"'
                    - '"2:3"'
                  x-apidog-enum:
                    - value: '"1:1"'
                      name: ''
                      description: ''
                    - value: '"16:9"'
                      name: ''
                      description: ''
                    - value: '"9:16"'
                      name: ''
                      description: ''
                    - value: '"4:3"'
                      name: ''
                      description: ''
                    - value: '"3:4" '
                      name: ''
                      description: ''
                    - value: '"3:2"'
                      name: ''
                      description: ''
                    - value: '"2:3"'
                      name: ''
                      description: ''
                  description: Aspect ratio of the generated video.
                duration:
                  type: integer
                  description: 'Video duration in seconds. Range: [1, 15]. Default: 8.'
                image:
                  type: object
                  properties:
                    url:
                      type: string
                      description: URL of the image or Base64-encoded
                  x-apidog-orders:
                    - url
                  required:
                    - url
                model:
                  type: string
                  description: Model to be used.
                output:
                  type: object
                  properties:
                    upload_url:
                      type: string
                      description: Signed URL to upload the generated video via HTTP PUT.
                  x-apidog-orders:
                    - upload_url
                  required:
                    - upload_url
                resolution:
                  type: string
                  description: |-
                    "480p" | "720p"
                    Resolution of the generated video.
                size:
                  type: string
                  description: >
                    "848x480" | "1696x960" | "1280x720" | "1920x1080"

                    The size of the generated video. DEPRECATED: Use
                    aspect_ratio and resolution instead. Defaults to "848x480"
                    (16:9) if not specified.
                user:
                  type: string
                  description: A unique identifier representing your end-user.
              x-apidog-orders:
                - prompt
                - aspect_ratio
                - duration
                - image
                - model
                - output
                - resolution
                - size
                - user
              required:
                - prompt
            examples:
              '1':
                value:
                  model: grok-imagine-video
                  prompt: >-
                    A glowing crystal-powered rocket launching from the red
                    dunes of Mars, ancient alien ruins lighting up in the
                    background as it soars into a sky full of unfamiliar
                    constellations
                  duration: 10
                  aspect_ratio: '16:9'
                  resolution: 720p
                summary: Default
              '2':
                value:
                  model: grok-imagine-video
                  prompt: >-
                    Animate the clouds drifting across the sky and add gentle
                    swaying to the trees
                  image:
                    url: https://example.com/landscape.jpg
                summary: Generate video from image URL
              '3':
                value:
                  model: grok-imagine-video
                  prompt: >-
                    Animate the clouds drifting across the sky and add gentle
                    swaying to the trees
                  image:
                    url: data:image/jpeg;base64,<YOUR_BASE64_IMAGE>
                summary: Generate video from Base64-encoded images.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                required:
                  - request_id
                x-apidog-orders:
                  - request_id
              example:
                request_id: a3d1008e-4544-40d4-d075-11527e794e4a
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: 📺 Video Models/XAI
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/810968/apis/api-28560492-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.cometapi.com
    description: Prod Env
security: []

```
