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

# Create video generation

> Generate 6- to 20-second videos with grok-imagine-video from text or reference images.

`/v1/videos/generations` returns a `task_id` immediately after submission. Generation time depends on duration and resolution, and is generally one to five minutes. Poll [`/v1/tasks/{task_id}`](/en/api-reference/videos/grok-imagine-video/tasks) for status.

<Note>
  The video endpoint currently supports only the `grok-imagine-video` model. Inference and billing use the special pricing for the Grok route.
</Note>

## Request URL

```http theme={null}
POST https://dimilinks.com/v1/videos/generations
Content-Type: application/json
Authorization: Bearer <DIMILINKS_API_KEY>
```

## Text-to-video example

```bash theme={null}
curl "https://dimilinks.com/v1/videos/generations" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "A group of neon jellyfish drifting slowly through the deep sea in cinematic light",
    "seconds": "6",
    "size": "1280x720",
    "resolution_name": "720p",
    "preset": "normal"
  }'
```

Successful response:

```json theme={null}
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "queued"
  }
}
```

After receiving `task_id`, call [Retrieve video task](/en/api-reference/videos/grok-imagine-video/tasks).

## Reference-image-to-video example

Convert reference images to `data:image/...;base64,...` Data URLs first. Browser `blob:` URLs cannot be submitted directly; your server must read the binary data and encode it.

```bash theme={null}
curl "https://dimilinks.com/v1/videos/generations" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "Keep the person consistent while the camera makes one complete orbit around the subject",
    "seconds": "10",
    "size": "1280x720",
    "resolution_name": "720p",
    "preset": "normal",
    "input_reference": [
      "data:image/png;base64,iVBORw0KGgo..."
    ]
  }'
```

## Parameters

| Parameter         | Type      | Required | Description                                                                                                         |
| ----------------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `model`           | string    | Yes      | Currently fixed to `grok-imagine-video`.                                                                            |
| `prompt`          | string    | Yes      | Video description, up to 2,500 characters.                                                                          |
| `seconds`         | string    | Yes      | Duration in seconds: `"6"` / `"10"` / `"12"` / `"16"` / `"20"`.                                                     |
| `size`            | string    | Yes      | Frame size: `1280x720` (16:9), `720x1280` (9:16), or `1024x1024` (1:1).                                             |
| `resolution_name` | string    | Yes      | Resolution tier: `720p` (HD) or `480p` (SD).                                                                        |
| `preset`          | string    | Yes      | Style preset: `normal` (standard), `fun` (high playfulness), `spicy` (high intensity), or `custom` (custom prompt). |
| `input_reference` | string\[] | No       | Array of up to seven reference-image Data URLs. When provided, enables reference-image-to-video mode.               |
| `group`           | string    | No       | Route group. Console requests include `default`; third-party callers generally leave it empty.                      |

## Duration and resolution combinations

* Use `720p` for final output. `480p` generates faster and is suitable for previews.
* Longer durations increase generation time and price. Start with `seconds: "6"` to validate the workflow.
* When changing the same prompt to `9:16` or `1:1`, describe where the subject should appear in the frame to avoid cropping.

## Error handling

The video endpoint also uses the OpenAI-style `error` wrapper. See [Errors](/en/api-reference/errors) for common errors. If a `400` response reports a reference-image problem, verify that:

* The reference image is PNG, JPEG, or WebP.
* It uses a Data URL, not a `blob:` URL or regular HTTP URL.
* Each reference image is smaller than 10 MB.
* The request includes no more than seven reference images.


## OpenAPI

````yaml POST /videos/generations
openapi: 3.1.0
info:
  title: DimiLinks API
  description: >-
    DimiLinks unified API for chat (OpenAI-compatible and Anthropic native),
    image generation/editing, and video generation.
  version: 1.1.0
servers:
  - url: https://dimilinks.com/v1
    description: OpenAI 兼容入口：chat completions / images / videos / models / tasks
security:
  - bearerAuth: []
tags:
  - name: Models
  - name: Chat
  - name: Images
  - name: Videos
  - name: Tasks
paths:
  /videos/generations:
    post:
      tags:
        - Videos
      summary: Create video generation
      operationId: createVideoGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerationRequest'
      responses:
        '200':
          description: Video task submission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoSubmitResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    VideoGenerationRequest:
      type: object
      properties:
        model:
          type: string
          default: grok-imagine-video
        prompt:
          type: string
          maxLength: 2500
        seconds:
          type: string
          enum:
            - '6'
            - '10'
            - '12'
            - '16'
            - '20'
        size:
          type: string
          enum:
            - 1280x720
            - 720x1280
            - 1024x1024
        resolution_name:
          type: string
          enum:
            - 480p
            - 720p
        preset:
          type: string
          enum:
            - normal
            - fun
            - spicy
            - custom
        input_reference:
          type: array
          items:
            type: string
            description: data:image/...;base64,... Data URL
          maxItems: 7
        group:
          type: string
      required:
        - model
        - prompt
        - seconds
        - size
        - resolution_name
        - preset
    VideoSubmitResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              example: video_xxx
            task_id:
              type: string
              example: video_xxx
            status:
              type: string
              enum:
                - queued
                - pending
                - submitted
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
          example: invalid_request_error
        code:
          oneOf:
            - type: string
            - type: integer
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Model is not allowed for this API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````