Skip to main content
POST
/
v1
/
videos
Create Video Generation
curl --request POST \
  --url https://api.deepinfra.com/v1/videos \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "aspect_ratio": "<string>",
  "size": "<string>",
  "seconds": 123,
  "seed": 123,
  "style": "<string>",
  "image_url": "<string>"
}
'
import requests

url = "https://api.deepinfra.com/v1/videos"

payload = {
"model": "<string>",
"prompt": "<string>",
"negative_prompt": "<string>",
"aspect_ratio": "<string>",
"size": "<string>",
"seconds": 123,
"seed": 123,
"style": "<string>",
"image_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
negative_prompt: '<string>',
aspect_ratio: '<string>',
size: '<string>',
seconds: 123,
seed: 123,
style: '<string>',
image_url: '<string>'
})
};

fetch('https://api.deepinfra.com/v1/videos', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.deepinfra.com/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'negative_prompt' => '<string>',
'aspect_ratio' => '<string>',
'size' => '<string>',
'seconds' => 123,
'seed' => 123,
'style' => '<string>',
'image_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.deepinfra.com/v1/videos"

payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123,\n \"seed\": 123,\n \"style\": \"<string>\",\n \"image_url\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.deepinfra.com/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123,\n \"seed\": 123,\n \"style\": \"<string>\",\n \"image_url\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.deepinfra.com/v1/videos")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"size\": \"<string>\",\n \"seconds\": 123,\n \"seed\": 123,\n \"style\": \"<string>\",\n \"image_url\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "created_at": 123,
  "status": "<string>",
  "model": "<string>",
  "object": "video.generation.job",
  "data": [
    {}
  ],
  "error": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

xi-api-key
string | null
x-api-key
string | null

Body

application/json
model
string
required
prompt
string
required
negative_prompt
string | null
aspect_ratio
string | null
size
string | null
seconds
integer | null
seed
integer | null
style
string | null
image_url
string | null

First-frame image for image-to-video (i2v): an http(s) URL or a data: URI. Omit for text-to-video.

Response

Successful Response

id
string
required
created_at
integer
required
status
string
required
model
string
required
object
string
default:video.generation.job
data
Data · object[] | null
error
string | null