act_two
Overview
This video-to-video model lets you animate characters using reference performance videos. Simply provide a video of someone acting out a scene along with a character reference (image or video), and Act-Two will transfer the performance to your character — including natural motion, speech, and facial expressions.
How to Make a Call
API Schemas
Video Generation
You can generate a video using this API. In the basic setup, you only need an image or video URL for the character (character
), and a video URL for body movements and/or facial expressions (reference
).
The character to control. You can either provide a video or an image. A visually recognizable face must be visible and stay within the frame.
The width and height of the video
1280:720
Possible values: A boolean indicating whether to enable body control. When enabled, non-facial movements and gestures will be applied to the character in addition to facial expressions.
An integer between 1 and 5 (inclusive). A larger value increases the intensity of the character's expression.
3
Varying the seed integer is a way to get different results for the same other request parameters. Using the same value for an identical request will produce similar results. If unspecified, a random number is chosen.
POST /v2/generate/video/runway/generation HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 218
{
"model": "runway/act_two",
"character": {
"type": "video",
"url": "https://example.com"
},
"reference": {
"type": "video",
"url": "https://example.com"
},
"frame_size": "1280:720",
"body_control": true,
"expression_intensity": 3,
"seed": 1
}
{
"id": "a12b3456-7c89-0de1-23f4-g567d584f98d",
"status": "queued"
}
Retrieve the generated video from the server
After sending a request for video generation, this task is added to the queue. This endpoint lets you check the status of a video generation task using its id
, obtained from the endpoint described above.
If the video generation task status is complete
, the response will include the final result — with the generated video URL and additional metadata.
Generation ID
a12b3456-7c89-0de1-23f4-g567d584f98d
GET /v2/generate/video/runway/generation HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Accept: */*
{
"id": "a12b3456-7c89-0de1-23f4-g567d584f98d",
"status": "queued",
"video": [
"https://example.com"
],
"error": "text"
}
Full Example: Generating and Retrieving the Video From the Server
As the character reference, we will use a scan of a famous Leonardo da Vinci painting. For the motion reference, we will use a video of a cheerful woman dancing, generated with the kling-video/v1.6/pro/text-to-video model.


We combine both POST and GET methods above in one program: first it sends a video generation request to the server, then it checks for results every 10 seconds.
Don’t forget to replace <YOUR_AIMLAPI_KEY>
with your actual AI/ML API key from your API Key management page — in both places in the code!
import requests
import time
# replace <YOUR_AIMLAPI_KEY> with your actual AI/ML API key
api_key = "<YOUR_AIMLAPI_KEY>"
base_url = "https://api.aimlapi.com/v2"
# Creating and sending a video generation task to the server
def generate_video():
url = f"{base_url}/generate/video/runway/generation"
headers = {
"Authorization": f"Bearer {api_key}",
}
data = {
"model": "runway/act_two",
"character":
{
"type":"image",
"url":"https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg"
},
"reference":
{
"type":"video",
"url": "https://zovi0.github.io/public_misc/kling-video-v1.6-pro-text-to-video-dancing-woman-output.mp4"
},
"frame_size":"1280:720",
"body_control":True,
"expression_intensity":3
}
response = requests.post(url, json=data, headers=headers)
if response.status_code >= 400:
print(f"Error: {response.status_code} - {response.text}")
else:
response_data = response.json()
print(response_data)
return response_data
# Requesting the result of the task from the server using the generation_id
def get_video(gen_id):
url = f"{base_url}/generate/video/runway/generation"
params = {
"generation_id": gen_id,
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.get(url, params=params, headers=headers)
# print("Generation:", response.json())
return response.json()
def main():
# Running video generation and getting a task id
gen_response = generate_video()
gen_id = gen_response.get("id")
print("Generation ID: ", gen_id)
# Trying to retrieve the video from the server every 10 sec
if gen_id:
start_time = time.time()
timeout = 1800
while time.time() - start_time < timeout:
response_data = get_video(gen_id)
if response_data is None:
print("Error: No response from API")
break
status = response_data.get("status")
print("Status:", status)
if status == "waiting" or status == "active" or status == "queued" or status == "generating":
print("Still waiting... Checking again in 10 seconds.")
time.sleep(10)
else:
print("Processing complete:/n", response_data)
return response_data
print("Timeout reached. Stopping.")
return None
if __name__ == "__main__":
main()
The following video was generated by running the code example above. Processing time: ~45 sec. Original: 784×1168

Last updated
Was this helpful?