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

# Generación de video Grok Imagine 1.5

>  - Modo de procesamiento asíncrono, devuelve un ID de tarea para consultas posteriores
- Generación de video con IA de alta calidad, admite text-to-video e image-to-video
- Opciones flexibles de relación de aspecto y calidad para distintas necesidades creativas 

<Info>
  **Aviso de compatibilidad de nombres de modelo**: Esta interfaz también admite el alias `grok-imagine-1.5-video-ext`, equivalente a `grok-imagine-1.5-video-apimart`; ambos son intercambiables y producen los mismos resultados.
</Info>

<RequestExample>
  ```bash cURL theme={null}
  # El campo model puede ser "grok-imagine-1.5-video-apimart" o el alias compatible "grok-imagine-1.5-video-ext"
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "grok-imagine-1.5-video-apimart",
      "prompt": "A dog running on the beach, sunny weather, slow motion",
      "size": "16:9",
      "duration": 6,
      "quality": "720p"
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "grok-imagine-1.5-video-apimart",
      "prompt": "A dog running on the beach, sunny weather, slow motion",
      "size": "16:9",
      "duration": 6,
      "quality": "720p"
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "grok-imagine-1.5-video-apimart",
    prompt: "A dog running on the beach, sunny weather, slow motion",
    size: "16:9",
    duration: 6,
    quality: "720p"
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
        "status": "submitted"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed, please check your API key",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient balance, please top up and try again",
      "type": "payment_required"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": 403,
      "message": "Access forbidden, you do not have permission to access this resource",
      "type": "permission_error"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests, please try again later",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error, please try again later",
      "type": "server_error"
    }
  }
  ```

  ```json 502 theme={null}
  {
    "error": {
      "code": 502,
      "message": "Bad gateway, server temporarily unavailable",
      "type": "bad_gateway"
    }
  }
  ```
</ResponseExample>

## Autorizaciones

<ParamField header="Authorization" type="string" required>
  Todas las APIs requieren autenticación mediante Bearer Token

  Obtener API Key:

  Visite la [página de gestión de API Keys](https://apimart.ai/keys) para obtener su API Key

  Añádala al encabezado de la solicitud:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Parámetros de la solicitud

<ParamField body="model" type="string" default="grok-imagine-1.5-video-apimart" required>
  Nombre del modelo de generación de video

  Modelos compatibles:

  * `grok-imagine-1.5-video-apimart` - Generación de video Grok (alias compatible `grok-imagine-1.5-video-ext`)

  Ejemplo: `"grok-imagine-1.5-video-apimart"`

  <Note>
    Para mantener la compatibilidad con llamadas anteriores, el alias `grok-imagine-1.5-video-ext` (corresponde a `grok-imagine-1.5-video-apimart`) sigue estando disponible.
  </Note>
</ParamField>

<ParamField body="prompt" type="string" required>
  Descripción del contenido del video, admite múltiples idiomas
</ParamField>

<ParamField body="size" type="string" default="16:9">
  Tamaño del video

  Opciones:

  * `16:9` - Horizontal (predeterminado)
  * `9:16` - Vertical
  * `1:1` - Cuadrado
  * `3:2` - Horizontal
  * `2:3` - Vertical
</ParamField>

<ParamField body="duration" type="integer" default={6}>
  Duración del video (segundos)

  Rango: 6-30 (mínimo 6 segundos, máximo 30 segundos)

  **⚠️ Nota:** Debe ser un número simple (por ejemplo, `6`), sin comillas, de lo contrario se producirá un error
</ParamField>

<ParamField body="quality" type="string" default="480p">
  Calidad del video

  Opciones:

  * `480p` - Definición estándar (predeterminado)
  * `720p` - Alta definición
</ParamField>

<ParamField body="image_urls" type="string[]">
  Lista de URLs de imágenes de referencia

  **Límites:**

  * Máximo 7 imágenes
  * Deben ser URLs de acceso público
  * No se admite el formato Base64

  <Tip>Tras subir una imagen de referencia, la relación de aspecto coincidirá automáticamente con la de la imagen de referencia.</Tip>
</ParamField>

## Respuesta

<ResponseField name="code" type="integer">
  Código de estado de la respuesta
</ResponseField>

<ResponseField name="data" type="object[]">
  Array de datos de la respuesta

  <Expandable title="Propiedades">
    <ResponseField name="task_id" type="string">
      Identificador único de la tarea
    </ResponseField>

    <ResponseField name="status" type="string">
      Estado de la tarea

      * `submitted` - Enviada
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  **Consultar el resultado de la tarea**

  La generación de video es una tarea asíncrona. Tras la solicitud, se devolverá un `task_id`. Use el endpoint [Obtener estado de la tarea](/es/api-reference/tasks/status) para consultar el progreso y los resultados de la generación.
</Note>

## Casos de uso

### Caso 1: Texto a video

```json theme={null}
{
  "model": "grok-imagine-1.5-video-apimart",
  "prompt": "A dog running on the beach, sunny weather, slow motion",
  "size": "16:9",
  "duration": 6
}
```

### Caso 2: Imagen a video

```json theme={null}
{
  "model": "grok-imagine-1.5-video-apimart",
  "prompt": "Bring the scene to life with natural dynamic effects",
  "image_urls": ["https://example.com/start.png"],
  "size": "16:9",
  "duration": 10,
  "quality": "720p"
}
```
