Inputs
When starting tasks through the Runway API, you’ll often need to provide assets like images. Some restrictions exist for what you can provide.
Assets can be provided via URLs or Data URIs.
URLs
In all cases, URLs must meet some basic minimum requirements:
- All URLs must be HTTPS.
- URLs must reference a domain name, not an IP address.
- The server should respond with valid
Content-Type
andContent-Length
headers.
Additionally, the server responding to the request must support HTTP HEAD
requests.
User agent
Runway will use a User-Agent
header that starts with RunwayML API/
when making requests
to your server. If you use a scraping-prevention tool or WAF, be sure to allowlist our
user agent string prefix.
Data URIs
A data URI allows you to pass the content of your asset as part of a request to our API, rather than passing a URL to the asset hosted on another server. This can reduce the complexity of your integration by eliminating an upload step.
Data URIs are supported anywhere URLs are expected. However, they come with some restrictions:
- The length of the encoded data URI must be under 3MB (1024 × 1024 × 3 bytes). Keep in mind that base64-encoding your asset increases its size by about 33%: this means that you may not be able to use data URIs with assets larger than about 2.2MB. This limit supersedes type-specific file size limits.
- The data URI must include an appropriate content type string. For instance, your data
URI should start with something like
data:image/jpg;base64,
.
If a data URI is not base64 encoded, it may not be accepted.
Considerations
If you do not already have your asset stored in object storage, submitting your asset with a data URI can save you a step. Using a data URI may also help to reduce the latency of API calls.
However, the 3MB limit may be too small for some assets, especially for video. If you cannot be sure that all assets are safely within the 2.2MB un-encoded size limit, you should upload assets to object storage instead.
Type-specific requirements
Images
For fields that accept images, the asset referenced by the URL must use one of the following
codecs, along with the corresponding Content-Type
header:
Codec | Content-Type header |
---|---|
JPEG | image/jpg or image/jpeg |
PNG | image/png |
WebP | image/webp |
All images are limited to 16MB.
Aspect ratios and auto-cropping
Gen-3 Alpha Turbo returns either 1280x768 or 768x1280 outputs. If your input asset is not exactly of this ratio, the model will auto-crop your asset from the center to the aspect ratio parameter provided.