Runway Gen 4 Image Serverless API

Runway's Gen-4 Image API enables precise, multimodal image generation for innovative creative and technical applications.

~30.64s
$0.1 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/runway-gen4-image"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "promptText": "photo of a model wearing a cloth and standing in a garden.",
12    "referenceImages": [
13        {
14            "uri": "https://segmind-inference-inputs.s3.amazonaws.com/c226e2cf-49ea-4b8d-a630-9847c0efbbce-Beach-walk.png",
15            "tag": "model"
16        },
17        {
18            "uri": "https://segmind-resources.s3.amazonaws.com/output/cfda480d-86f3-4230-aed3-fcfae874df3b-saree.webp",
19            "tag": "cloth"
20        }
21    ],
22    "ratio": "1280:720"
23}
24
25response = requests.post(url, headers=headers, json=data)
26
27if response.status_code == 200:
28    result = response.json()
29    print(json.dumps(result, indent=2))
30else:
31    print(f"Error: {response.status_code}")
32    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/runway-gen4-image

Parameters

promptTextrequired
string

Describes the desired animation. Use 'rainforest waterfall' for nature or 'cyberpunk alley' for futurism.

referenceImagesrequired
object[]

Upload images and select appropriate labels

Array items:
urioptional
string (uri)

A list of images and tags.

tagrequired
string

Tag for this image

ratiooptional
string

Sets output aspect ratio. Choose 1280:720 for YouTube or 1920:1080 for HD movies.

Default: "1280:720"
Allowed values :
"1280:720""720:1280""1104:832""832:1104""960:960""1584:672""1920:1080""1080:1920"

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out