> ## 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.

# Create a Runway text-to-video task

> Generate a video from a text prompt with Runway Gen-4.5 through CometAPI.

Use `gen4.5` to generate a video from a text prompt. Send your CometAPI API
key with Bearer authentication and a JSON request body.

## Prepare the request

* Set `model` to `gen4.5`.
* Describe the scene and motion in `promptText`, using 1 to 1,000 UTF-16 code units.
* Set `ratio` to `1280:720` for landscape or `720:1280` for portrait.
* Set `duration` to a whole number from `2` through `10` seconds.

All four fields are required. To start from an image, use
[Create a Runway image-to-video task](./runway-images-raw-video).
Do not include `promptImage` or an `audio` toggle in this text-to-video request.

## Set optional controls

For an explicit sampling seed, use `1` through `4294967295`. Omission or `0`
selects a random seed. If you include `contentModeration`, set its
`publicFigureThreshold` to `auto` or `low`; otherwise omit the object.

Use `outputFormat` to select MP4, ProRes, PNG sequences, or one of the HDR
formats listed in the request schema. Omit it for H.264 MP4. You can set
`proresProfile` only when `outputFormat` is `prores` or `hdr_prores`.
The HDR ProRes format accepts `422`, `422 HQ`, or `4444`.

## Retrieve the result

Save the returned `id` and use [Get a Runway task](./runway-to-get-task-details).
When `status` is `SUCCEEDED`, read the video URLs in `output`.


## OpenAPI

````yaml api/openapi/video/runway/official-format/post-generate-a-video-from-text.openapi.json POST /runwayml/v1/text_to_video
openapi: 3.1.0
info:
  title: Create a Runway text-to-video task
  version: 1.0.0
  description: Create a Runway text-to-video task through CometAPI.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /runwayml/v1/text_to_video:
    post:
      summary: Create a Runway text-to-video task
      description: >-
        Submit a JSON request and save the returned id. Use GET
        /runwayml/v1/tasks/{id} to retrieve the result.
      operationId: text_to_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: gen4.5
              type: object
              properties:
                model:
                  type: string
                  description: Model ID for this request variant.
                  const: gen4.5
                  enum:
                    - gen4.5
                promptText:
                  description: >-
                    Describe the requested scene or motion in 1 to 1,000 UTF-16
                    code units.
                  type: string
                  minLength: 1
                  maxLength: 1000
                ratio:
                  description: >-
                    Requested output dimensions, expressed as width:height.
                    Choose a value listed for this model and endpoint.
                  type: string
                  enum:
                    - '1280:720'
                    - '720:1280'
                duration:
                  description: >-
                    Requested video duration in whole seconds, from 2 through
                    10.
                  type: integer
                  minimum: 2
                  maximum: 10
                seed:
                  type: integer
                  minimum: 0
                  maximum: 4294967295
                  description: >-
                    Optional sampling seed. Use a positive integer for an
                    explicit seed. Omission or 0 selects a random seed.
                contentModeration:
                  type: object
                  description: >-
                    Optional content moderation settings. Omit the object to use
                    standard moderation.
                  properties:
                    publicFigureThreshold:
                      type: string
                      description: >-
                        Use auto for standard moderation or low for less
                        restrictive public-figure filtering.
                      enum:
                        - auto
                        - low
                  required:
                    - publicFigureThreshold
                  additionalProperties: false
                outputFormat:
                  description: >-
                    Output encoding. Omit for mp4 (H.264). prores returns MOV;
                    png_sequence returns a PNG ZIP; sdr_rec709_10bit returns
                    10-bit Rec.709 HEVC. hdr10 and hlg return 10-bit HDR MP4;
                    hdr_pq_12bit_master returns 12-bit HEVC MOV; hdr_prores
                    returns HDR ProRes MOV. The HDR PNG/EXR sequence formats
                    return ZIP archives; the ACEScg variants target the named
                    ACES version.
                  type: string
                  enum:
                    - mp4
                    - prores
                    - png_sequence
                    - hdr10
                    - hlg
                    - sdr_rec709_10bit
                    - hdr_pq_12bit_master
                    - hdr_prores
                    - hdr_png_sequence
                    - hdr_exr_sequence
                    - hdr_exr_acescg_sequence_1_3
                    - hdr_exr_acescg_sequence_2_0
                proresProfile:
                  description: >-
                    Profile for outputFormat prores or hdr_prores. Omit for 4444
                    with prores, or 422 HQ with hdr_prores. hdr_prores accepts
                    only 422, 422 HQ, or 4444. Omit this field for other
                    formats.
                  type: string
                  enum:
                    - '422'
                    - '4444'
                    - 422 Proxy
                    - 422 LT
                    - 422 HQ
                    - 4444 XQ
              required:
                - promptText
                - ratio
                - duration
                - model
              allOf:
                - if:
                    required:
                      - proresProfile
                  then:
                    required:
                      - outputFormat
                    properties:
                      outputFormat:
                        type: string
                        description: Output format when proresProfile is supplied.
                        enum:
                          - prores
                          - hdr_prores
                - if:
                    required:
                      - outputFormat
                    properties:
                      outputFormat:
                        const: hdr_prores
                        description: HDR ProRes output.
                  then:
                    properties:
                      proresProfile:
                        type: string
                        description: Profile supported by HDR ProRes.
                        enum:
                          - '422'
                          - 422 HQ
                          - '4444'
              additionalProperties: false
              description: Request parameters for gen4.5.
            examples:
              Gen-4.5:
                summary: Gen-4.5
                value:
                  model: gen4.5
                  promptText: A paper boat drifts on calm water at sunrise.
                  ratio: '1280:720'
                  duration: 5
      responses:
        '200':
          description: Task submitted. Save its id to retrieve task status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Task ID for GET /runwayml/v1/tasks/{id}.
                  status:
                    type: string
                    description: Task state, when returned.
                  createdAt:
                    type: string
                    description: Task submission timestamp, when returned.
                    format: date-time
                  output:
                    type: array
                    description: Result URLs, when returned.
                    items:
                      type: string
                      format: uri
                  failure:
                    type: string
                    description: Failure explanation, when returned.
                  failureCode:
                    type: string
                    description: Machine-readable failure code, when returned.
                  estimatedCost:
                    type: object
                    description: Task estimate metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                  cost:
                    type: object
                    description: Task cost metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                required:
                  - id
                additionalProperties: false
              example:
                id: 00000000-0000-4000-8000-000000000001
        '400':
          description: Invalid request or unavailable task ID.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Task request error.
                    properties:
                      code:
                        type:
                          - string
                          - integer
                        description: Machine-readable task error code.
                      message:
                        type: string
                        description: Error explanation.
                      data:
                        description: Additional error details, when returned.
                    required:
                      - code
                      - message
                    additionalProperties: true
                  - type: object
                    description: Request authentication or validation error.
                    properties:
                      error:
                        type: object
                        description: Error details.
                        properties:
                          message:
                            type: string
                            description: Error explanation.
                          type:
                            type: string
                            description: Error category.
                          code:
                            type:
                              - string
                              - integer
                              - 'null'
                            description: Error code, when returned.
                        required:
                          - message
                        additionalProperties: true
                    required:
                      - error
                    additionalProperties: true
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                type: object
                description: Request authentication or validation error.
                properties:
                  error:
                    type: object
                    description: Error details.
                    properties:
                      message:
                        type: string
                        description: Error explanation.
                      type:
                        type: string
                        description: Error category.
                      code:
                        type:
                          - string
                          - integer
                          - 'null'
                        description: Error code, when returned.
                    required:
                      - message
                    additionalProperties: true
                required:
                  - error
                additionalProperties: true
      x-codeSamples:
        - lang: Shell
          label: Gen-4.5
          source: |
            curl "https://api.cometapi.com/runwayml/v1/text_to_video" \
              --request POST \
              --header "Authorization: Bearer $COMETAPI_KEY" \
              --header "Content-Type: application/json" \
              --data '{
              "model": "gen4.5",
              "promptText": "A paper boat drifts on calm water at sunrise.",
              "ratio": "1280:720",
              "duration": 5
            }'
        - lang: Python
          label: Gen-4.5
          source: |
            import os
            import requests

            payload = {'model': 'gen4.5',
             'promptText': 'A paper boat drifts on calm water at sunrise.',
             'ratio': '1280:720',
             'duration': 5}

            response = requests.post(
                "https://api.cometapi.com/runwayml/v1/text_to_video",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json=payload,
                timeout=60,
            )
            response.raise_for_status()
            print(response.json()["id"])
        - lang: JavaScript
          label: Gen-4.5
          source: |
            const payload = {
              "model": "gen4.5",
              "promptText": "A paper boat drifts on calm water at sunrise.",
              "ratio": "1280:720",
              "duration": 5
            };

            const response = await fetch(
              "https://api.cometapi.com/runwayml/v1/text_to_video",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify(payload),
              },
            );
            if (!response.ok) throw new Error(await response.text());
            console.log((await response.json()).id);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use your CometAPI API key.

````