title
Quickstart
description
Make your first Vinci API call and poll job status in 5 minutes (Python & JavaScript).
Keep your API key secret. Do not expose keys in client-side code.
# No extra deps needed for fetch in Node 18+. For older versions, use node-fetch.
2) Create your first video (Text-to-Video)
curl -X POST "https://tryvinci.com/api/v1/generate/text-to-video" \
-H "Authorization: Bearer sk-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene sunset over a calm lake",
"duration_seconds": 5,
"aspect_ratio": "16:9"
}'
import requests , time
API_KEY = "sk-your-api-key-here"
url = "https://tryvinci.com/api/v1/generate/text-to-video"
headers = {
"Authorization" : f"Bearer { API_KEY } " ,
"Content-Type" : "application/json"
}
data = {
"prompt" : "A serene sunset over a calm lake" ,
"duration_seconds" : 5 ,
"aspect_ratio" : "16:9"
}
resp = requests .post (url , headers = headers , json = data )
resp .raise_for_status ()
result = resp .json ()
print (f"Request ID: { result ['request_id' ]} " )
const API_KEY = "sk-your-api-key-here" ;
const response = await fetch ( "https://tryvinci.com/api/v1/generate/text-to-video" , {
method : "POST" ,
headers : {
"Authorization" : `Bearer ${ API_KEY } ` ,
"Content-Type" : "application/json" ,
} ,
body : JSON . stringify ( {
prompt : "A serene sunset over a calm lake" ,
duration_seconds : 5 ,
aspect_ratio : "16:9" ,
} ) ,
} ) ;
if ( ! response . ok ) throw new Error ( `HTTP ${ response . status } ` ) ;
const result = await response . json ( ) ;
console . log ( `Request ID: ${ result . request_id } ` ) ;
curl -X GET "https://tryvinci.com/api/v1/status/your-request-id" \
-H "Authorization: Bearer sk-your-api-key-here"
import requests , time
API_KEY = "sk-your-api-key-here"
request_id = "your-request-id"
status_url = f"https://tryvinci.com/api/v1/status/{ request_id } "
headers = {"Authorization" : f"Bearer { API_KEY } " }
while True :
r = requests .get (status_url , headers = headers )
r .raise_for_status ()
status = r .json ()
if status ["status" ] == "completed" :
print (f"Video ready: { status ['video_url' ]} " )
break
if status ["status" ] == "failed" :
print ("Generation failed" )
break
print (f"Status: { status ['status' ]} " )
time .sleep (5 )
const API_KEY = "sk-your-api-key-here" ;
const requestId = "your-request-id" ;
async function checkStatus ( ) {
const r = await fetch ( `https://tryvinci.com/api/v1/status/${ requestId } ` , {
headers : { "Authorization" : `Bearer ${ API_KEY } ` } ,
} ) ;
if ( ! r . ok ) throw new Error ( `HTTP ${ r . status } ` ) ;
const status = await r . json ( ) ;
if ( status . status === "completed" ) {
console . log ( `Video ready: ${ status . video_url } ` ) ;
return ;
}
if ( status . status === "failed" ) {
console . log ( "Generation failed" ) ;
return ;
}
console . log ( `Status: ${ status . status } ` ) ;
setTimeout ( checkStatus , 5000 ) ;
}
checkStatus ( ) ;
Learn how to properly authenticate your API requests.
Explore the full video generation API reference.
Understand billing and monitor your usage.
Learn how to handle errors gracefully.