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

# Crear una tarea de imagen a video de Runway

> Usa CometAPI para llamar a Runway image_to_video y convertir la URL de una imagen fija en salida de video sin procesar, con compatibilidad mediante X-Runway-Version.

Usa este endpoint para animar una imagen de origen en un video de Runway.

## Antes de llamarlo

* Envía el encabezado `X-Runway-Version` requerido, por ejemplo `2024-11-06`
* Usa `model: gen3a_turbo`
* Proporciona un `promptImage` HTTPS estable
* Comienza con `duration: 5` y un valor de ratio compatible para el modelo/versión de Runway seleccionado

## Duration y ratio

| Setting                                            | Supported values                                                                                                             | Default starting point | Boundary behavior                                                                                                                   |
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `duration`                                         | Depende del modelo/versión de Runway; usa `5` o `10` para la compatibilidad más amplia                                       | `5`                    | CometAPI reenvía el valor a Runway. Si el modelo/versión seleccionado lo rechaza, vuelve a intentarlo con `5`.                      |
| `ratio` con `X-Runway-Version: 2024-11-06`         | Valores de estilo resolución dependientes del modelo/versión de Runway, como `1280:768`, `768:1280`, `1280:720` o `720:1280` | `1280:768`             | Los valores solicitados pueden normalizarse en el medio completado; inspecciona el video final antes de confiar en píxeles exactos. |
| `ratio` con versiones de compatibilidad anteriores | `16:9`, `9:16` o los valores de estilo resolución aceptados por el modelo/versión seleccionado                               | `16:9` o `1280:768`    | Para integraciones en producción, prefiere los valores actuales de Runway de estilo resolución.                                     |

Las solicitudes en formato oficial de Runway usan `ratio`, no `size`. Interpreta los valores de ratio de estilo resolución como su equivalente `WxH`: `1280:720` corresponde a `1280x720`, `720:1280` corresponde a `720x1280`, y `1280:768` aún puede renderizarse como `1280x720` según el modelo/versión seleccionado.

## Flujo de la tarea

<Steps>
  <Step title="Enviar la solicitud de imagen a video">
    Crea la tarea con una imagen de origen y un Prompt de movimiento corto opcional.
  </Step>

  <Step title="Guardar el id devuelto">
    Guarda el `id` de la tarea para consultarlo más tarde.
  </Step>

  <Step title="Consultar el estado de la tarea">
    Usa [Obtener una tarea de Runway](./runway-to-get-task-details). Si la primera consulta devuelve `task_not_exist`, espera unos segundos y vuelve a intentarlo.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/runway/official-format/post-runway-images-raw-video.openapi.json POST /runwayml/v1/image_to_video
openapi: 3.1.0
info:
  title: Image to Video API
  version: 1.0.0
  description: >-
    Create a Runway image-to-video task through the official-format CometAPI
    route.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /runwayml/v1/image_to_video:
    post:
      summary: Create a Runway image-to-video task
      description: >-
        Submit a source image plus optional motion prompt and receive a task id
        for later polling.
      operationId: runway_images_raw_video
      parameters:
        - name: X-Runway-Version
          in: header
          required: true
          description: Runway version header, for example `2024-11-06`.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - promptImage
                - model
              properties:
                promptImage:
                  type: string
                  description: Source image URL.
                  default: >-
                    https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
                seed:
                  type: integer
                  description: 'Random seed for reproducible results. Range: 0–999999999.'
                model:
                  type: string
                  description: >-
                    Runway image-to-video model ID. Choose an available model
                    from the [Models page](/overview/models).
                  default: gen3a_turbo
                promptText:
                  type: string
                  description: >-
                    Text prompt describing the desired motion or scene. Maximum
                    512 characters.
                watermark:
                  type: boolean
                  description: Whether to add a watermark to the output video.
                  default: false
                duration:
                  type: integer
                  description: >-
                    Video duration in seconds. Runway support is model/version
                    dependent; use 5 or 10 for the broadest compatibility.
                    CometAPI forwards this value to Runway.
                  default: 5
                ratio:
                  type: string
                  description: >-
                    Requested output ratio. Accepted values are Runway
                    model/version dependent. With X-Runway-Version 2024-11-06,
                    use a resolution-style value accepted by the selected model,
                    such as 1280:768, 768:1280, 1280:720, or 720:1280. Read
                    these as WxH targets, but completed media may normalize, so
                    inspect the returned file before relying on exact pixels.
                  default: '1280:768'
              default:
                promptImage: >-
                  https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
                seed: 1
                model: gen3a_turbo
                promptText: A calm camera move.
                watermark: false
                duration: 5
                ratio: '1280:768'
            examples:
              Default:
                summary: Default
                value:
                  promptImage: >-
                    https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
                  seed: 1
                  model: gen3a_turbo
                  promptText: A calm camera move.
                  watermark: false
                  duration: 5
                  ratio: '1280:768'
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                example:
                  id: d0658ae1-bbdd-4adc-aaba-fd8070e14d79
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/runwayml/v1/image_to_video \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "promptImage": "https://your-image-host/first-frame.png",
                  "promptText": "A calm camera move.",
                  "model": "gen3a_turbo",
                  "ratio": "1280:768",
                  "duration": 5
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/runwayml/v1/image_to_video",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "promptImage": "https://your-image-host/first-frame.png",
                        "promptText": "A calm camera move.",
                        "model": "gen3a_turbo",
                        "ratio": "1280:768",
                        "duration": 5
                },
            )


            task = response.json()

            print(task["id"])  # poll GET /runwayml/v1/tasks/{id} until the
            output array appears
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/runwayml/v1/image_to_video", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "promptImage": "https://your-image-host/first-frame.png",
                        "promptText": "A calm camera move.",
                        "model": "gen3a_turbo",
                        "ratio": "1280:768",
                        "duration": 5
                    }),
            });


            const task = await response.json();

            console.log(task.id); // poll GET /runwayml/v1/tasks/{id} until the
            output array appears
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````