Create a video using text and/or image prompts

August 8, 2024 (October 10, 2024)

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

We added designated Gen-3 Alpha Turbo endpoint.

This endpoint will no longer accept turbo and aspect_ratio params starting November 1, 2024.
Please consider switching all turbo load to Gen-3 Alpha Turbo before deadline.

Runway AI Tools » Audio tools » Text/Image to Video » Gen-3 Alpha.

Creating with Gen-3 Alpha.

Please be aware that Runway’s moderation system analyzes your image and text prompts and may fail task with moderation message if the prompt is determined to be offensive. Runway monitors the rate and the number of moderated tasks, which may result in your account being suspended when the internal threshold is exceeded.

https://api.useapi.net/v1/runwayml/gen3/create

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
    "email": "Optional Runway API account email",
    "turbo": true,
    "image_assetId": "Optional assetId of image asset",
    "text_prompt": "Optional text prompt",
    "enhance_prompt": true,
    "image_as_end_frame": false,
    "seconds": 5,
    "seed": 12345678
    "exploreMode": true,    
    "replyUrl": "Place your call back URL here",
    "replyRef": "Place your reference id here",
    "maxJobs": 5
}
  • email is optional, if not provided and parameter image_assetId is not specified API will randomly select available account.

  • turbo is optional. Set to true if you want to use Gen-3 Alpha Turbo mode.
    Turbo mode provides significantly faster generation times with 50% cost reduction, at 5 credits per second of video generation. Turbo mode is supported with free accounts and is the only way to experience Runway Gen-3 Alpha if you have a free account.
    NOTE: Turbo mode requires image_assetId.

  • aspect_ratio is optional and is only available when turbo is set to true, Gen-3 Alpha Turbo mode selected.
    Supported values: landscape (default), portrait.

  • image_assetId is optional. Specify the image assetId you want to be present in the first frame. Use GET /assets/?mediaType=image to see the list of image assets. To upload a new image asset use POST /assets. Currently Runway only supports image sizes up to 1280x768 maximum. All other images will be cropped to fit 1280x768. You may want to upscale/downscale your image using image_upscaler to achieve the best results.

  • text_prompt is optional. Describe your shot. Gen-3 Alpha Prompting Guide.

  • enhance_prompt is optional.
    Supported values: true (default), false.

  • image_as_end_frame is optional. Use provided above image as a last frame.
    Supported values: true, false (default).

  • seconds is optional. Specify desired length of the video in seconds.
    Supported values: 5 (default), 10.

  • seed is optional.
    Valid range 1…4294967294.

  • resolution is optional.
    Supported values: 720p (default).

  • exploreMode is optional. Set to true if you have a Runway Unlimited plan and wish to execute relaxed generation. You are not charged credits for Explore mode generations.

  • replyUrl is optional, if not provided value from account will be used.
    Place here your callback URL. API will call the provided replyUrl once Runway task completed or failed.
    Maximum length 1024 characters.
    We recommend using sites like webhook.site to test callback URL functionality.

  • replyRef is optional, place here your reference id which will be stored and returned along with this Runway task response / result.
    Maximum length 1024 characters.

  • maxJobs is optional, if not provided value for referenced by image assetId account will be used.
    Valid range: 1…10.

Responses
  • 200 OK

    Use returned taskId to retrieve task status and results using GET /tasks/taskId. The generated video url can be found in the artifacts array of the task with the status SUCCEEDED.

    If you specify the optional parameter replyUrl the API will call the provided replyUrl with task progress updates until the task is complete or fails.

    {
        "taskId": "user:user_id-runwayml:account_email-task:task_uuid",
        "id": "<uuid>",
        "name": "<name>",
        "image": null,
        "createdAt": "2024-08-01T01:02:03.456Z",
        "updatedAt": "2024-08-01T01:02:03.456Z",
        "taskType": "gen3a",
        "options": {
            "name": "<name>",
            "seconds": 10,
            "text_prompt": "<your text prompt>",
            "seed": 12345789,
            "exploreMode": true,
            "watermark": false,
            "enhance_prompt": true,
            "image_as_end_frame": true,
            "init_image": "<asset image url>",
            "width": 1280,
            "height": 768,
            "assetGroupName": "Generative Video",
            "recordingEnabled": true
        },
        "status": "PENDING",
        "error": null,
        "progressText": null,
        "progressRatio": null,
        "estimatedTimeToStartSeconds": 0,
        "artifacts": [],
        "sharedAsset": null,
        "features": {
            "storageGB": 500,
            "numPlanCredits_permitted": 2250,
            "numPlanCredits_used": 1315
        },    
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
        "code": 200
    }
    
  • 400 Bad Request

    {
      "error": "<Error message>",
      "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 404 Not Found

    {
        "error": "Unable to retrieve assetId <uuid> (Not found.)",
        "code": 404
    }
    
  • 429 Too Many Requests

    Wait in a loop for at least 10..30 seconds and retry again.

    There are two possible cases for API response 429:

    {
        "error": "Account <Runway account email> is busy executing <Account maxJobs> tasks",
        "runningTasks": {
            "<Runway account email>": [
                {
                    "email": "<Runway account email>",
                    "taskId": "user:user_id-runwayml:account_email-task:task_#1_uuid",
                    "id": "<uuid>",
                    "replyUrl": "<replyUrl if provided>",
                    "replyRef": "<replyRef if provided>"
                },
                {
                    "email": "<Runway account email>",
                    "taskId": "user:user_id-runwayml:account_email-task:task_#N_uuid",
                    "id": "<uuid>",
                    "replyUrl": "<replyUrl if provided>",
                    "replyRef": "<replyRef if provided>"
                }
            ]
        },
        "code": 429
    }
    
    • The API received an HTTP response status 429 from Runway. Runway has dynamic query management and may limit the number of simultaneously executed tasks based on internal service load and policies.
    {
        "error": "You have too many tasks running or pending. Please wait for some of them to finish before starting more."
    }
    
Model
{ // TypeScript, all fields are optional
  taskId: string,
  id: string,
  name: string,
  image: string,
  createdAt: string,
  updatedAt: string,
  taskType: string,
  options: {
        name: string,
        seconds: number,
        text_prompt: string,
        init_image: string,
        seed: number,
        exploreMode: boolean,
        watermark: boolean,
        enhance_prompt: boolean,
        image_as_end_frame: boolean,
        flip: boolean,
        width: number,
        height: number,
        assetGroupName: string,
        recordingEnabled: boolean
  },
  status: string,
  progressText: string,
  progressRatio: number,
  estimatedTimeToStartSeconds: number,
  artifacts: any[],
  sharedAsset: any,
  features: {
    storageGB: number,
    numPlanCredits_permitted: number,
    numPlanCredits_used: number
  },    
  error: {
    errorMessage: string,
    reason: string,
    message: string,
    moderation_category: string,
    tally_asimov: boolean
  },  
  code: number,
  replyUrl: string,
  replyRef: string
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST "https://api.useapi.net/v1/runwayml/gen3/create" \
         -d '{"image_assetId": "…", "text_prompt": "…"}'
    
  • const image_assetId = "assetId of image asset";      
    const text_prompt = "text prompt";      
    const apiUrl = `https://api.useapi.net/v1/runwayml/gen3/create`; 
    const token = "API token";
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      image_assetId, text_prompt
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    image_assetId = "assetId of image asset"      
    text_prompt = "text prompt"      
    apiUrl = f"https://api.useapi.net/v1/runwayml/gen3/create" 
    token = "API token"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "image_assetId": f"{image_assetId}",
        "text_prompt": f"{text_prompt}"
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It