act_two
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).
Bearer key
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:720Possible 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.
3Varying 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.
Successfully generated video
async function main() {
const response = await fetch('https://api.aimlapi.com/v2/video/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_API_KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "runway/act_two",
"character": {
"type": "image",
"url": "https://fs.tonkosti.ru/33/ol/33olc2eyzj6s4w8ksg8kkc0gg.jpg"
},
"reference": {
"type": "video",
"url": "https://videos.pexels.com/video-files/3044160/3044160-uhd_2560_1440_24fps.mp4"
}
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
main();Successfully generated video
{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"video": {
"url": "https://cdn.aimlapi.com/generations/hedgehog/1759866285599-0cdfb138-c03a-49d4-a601-4f6413e27b15.mp4",
"duration": 8
},
"duration": 8,
"error": null,
"meta": {
"usage": {
"tokens_used": 120000
}
}
}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.
Bearer key
Generation ID
a12b3456-7c89-0de1-23f4-g567d584f98dSuccessfully generated video
GET /v2/generate/video/runway/generation?generation_id=a12b3456-7c89-0de1-23f4-g567d584f98d HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Successfully generated video
{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"video": {
"url": "https://cdn.aimlapi.com/generations/hedgehog/1759866285599-0cdfb138-c03a-49d4-a601-4f6413e27b15.mp4",
"duration": 8
},
"duration": 8,
"error": null,
"meta": {
"usage": {
"tokens_used": 120000
}
}
}Full Example: Generating and Retrieving the Video From the Server
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)
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?

