Enterprise: Open Sora Endpoint
Overview
The Open Sora endpoint generate captivating video by passing in text prompt
Request
--request POST 'https://modelslab.com/api/v1/enterprise/video/open_sora' \
Make a POST
request to https://modelslab.com/api/v1/enterprise/video/open_sora endpoint and pass the required parameters in the request body.
Body Attributes
Parameter | Description | Values |
---|---|---|
key | Your unique API key used for authorization. | string |
prompt | The input text for video generation. | string |
height | The height of the video. Default is 320 pixels. Maximum height is 768 pixels. | integer |
width | The width of the video. Default is 576 pixels. Maximum width is 768 pixels. | integer |
fps | Frames per second. The duration of the video is calculated as the number of frames divided by the FPS. Default is 7 FPS. Maximum is 16 FPS. | integer |
temp | Indicates whether to use a temporary file for the processed video. Default is "yes". Options: "yes" or "no". | "yes"/"no" |
Example
Body
Body
{
"key":"",
"prompt":"a dog playing cards",
"height":"256",
"width":256,
"num_frames": 25,
"fps":12,
"webhook":null,
"track_id": null
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key":"",
"prompt":"a dog playing cards",
"height": 256,
"width":256,
"num_frames": 25,
"fps":12,
"webhook":null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v1/enterprise/video/open_sora", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"prompt" =>"a dog playing cards",
"height" =>256,
"width" => 256,
"num_frames" => 25,
"fps" => 12,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/video/open_sora',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://modelslab.com/api/v1/enterprise/video/open_sora',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key":"",
"prompt":"a dog playing cards",
"height": 256,
"width":256,
"num_frames": 25,
"fps":12,
"webhook":null,
"track_id": null
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://modelslab.com/api/v1/enterprise/video/open_sora"
payload = json.dumps({
"key":"",
"prompt":"a dog playing cards",
"height": 256,
"width":256,
"num_frames": 25,
"fps":12,
"webhook":None,
"track_id": None
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"key\":\"\",\r\n \"prompt\":\"a dog playing cards\",\r\n \"height\":\"256\",\r\n \"width\":256,\r\n \"num_frames\": 25,\r\n \"fps\":12,\r\n \"webhook\":null,\r\n \"track_id\": null\r\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v1/enterprise/video/open_sora")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 10.56,
"id": 148,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/8d299336-e805-4e75-bc0e-02fe03f87edf.mp4"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/8d299336-e805-4e75-bc0e-02fe03f87edf.mp4"
],
"meta": {
"ar": 25,
"batch_size": 1,
"file_prefix": "8d299336-e805-4e75-bc0e-02fe03f87edf",
"fps": 12,
"frame_interval": 3,
"height": 256,
"num_frames": 25,
"output_type": "mp4",
"prompt": null,
"seed": 1902962721,
"temp": "no",
"width": 256
}
}