curl --request POST \
--url https://api.deepshi.ai/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-video",
"prompt": "a paper boat drifting down a rain-soaked street at night",
"resolution": "480p",
"duration": 4
}
'import requests
url = "https://api.deepshi.ai/v1/videos"
payload = {
"model": "grok-imagine-video",
"prompt": "a paper boat drifting down a rain-soaked street at night",
"resolution": "480p",
"duration": 4
}
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: 'grok-imagine-video',
prompt: 'a paper boat drifting down a rain-soaked street at night',
resolution: '480p',
duration: 4
})
};
fetch('https://api.deepshi.ai/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.deepshi.ai/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' => 'grok-imagine-video',
'prompt' => 'a paper boat drifting down a rain-soaked street at night',
'resolution' => '480p',
'duration' => 4
]),
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.deepshi.ai/v1/videos"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\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.deepshi.ai/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.ai/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\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\n}"
response = http.request(request)
puts response.read_body{
"id": "vid_a1b2c3",
"object": "video",
"model": "grok-imagine-video",
"status": "queued",
"size": "480p",
"seconds": "4"
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Create a video job
Create an asynchronous video generation job from a text prompt, or from an image when input_reference is set (image-to-video). Returns a job with status: "queued"; poll GET /v1/videos/{video_id} until it is completed. Beyond model and prompt, each model accepts its own parameters such as resolution, duration, aspect_ratio, and generate_audio; call GET /v1/models to see the ones a model supports. Video is priced per second of output and billed once, on completion; pricing is shown on deepshi.ai.
curl --request POST \
--url https://api.deepshi.ai/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-video",
"prompt": "a paper boat drifting down a rain-soaked street at night",
"resolution": "480p",
"duration": 4
}
'import requests
url = "https://api.deepshi.ai/v1/videos"
payload = {
"model": "grok-imagine-video",
"prompt": "a paper boat drifting down a rain-soaked street at night",
"resolution": "480p",
"duration": 4
}
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: 'grok-imagine-video',
prompt: 'a paper boat drifting down a rain-soaked street at night',
resolution: '480p',
duration: 4
})
};
fetch('https://api.deepshi.ai/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.deepshi.ai/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' => 'grok-imagine-video',
'prompt' => 'a paper boat drifting down a rain-soaked street at night',
'resolution' => '480p',
'duration' => 4
]),
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.deepshi.ai/v1/videos"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\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.deepshi.ai/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.ai/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\": \"grok-imagine-video\",\n \"prompt\": \"a paper boat drifting down a rain-soaked street at night\",\n \"resolution\": \"480p\",\n \"duration\": 4\n}"
response = http.request(request)
puts response.read_body{
"id": "vid_a1b2c3",
"object": "video",
"model": "grok-imagine-video",
"status": "queued",
"size": "480p",
"seconds": "4"
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Authorizations
Your Deepshi API key, sent as Authorization: Bearer <key>.
Body
Video generation request. model and prompt are required. The remaining fields are optional and model-specific; a model ignores any field it does not support. Call GET /v1/models for the parameters each model accepts. Additional model-specific parameters not listed here may also be sent and are forwarded to the model.
The video model id. See GET /v1/models.
"grok-imagine-video"
Text description of the video to generate.
"a paper boat drifting down a rain-soaked street"
A public image URL or data: URI. Switches the model to image-to-video mode. Only supported models accept it.
Model-specific. Resolution tier such as 480p, 720p, 1080p, or 4k. Allowed values are per model and set the billed price on resolution-priced models.
"480p"
Model-specific. Clip length in seconds (the billed length). An enum for some models, a range for others.
4
Model-specific. Aspect ratio such as 16:9 or 9:16. Some models add auto in image-to-video mode.
"16:9"
Model-specific. Generate a soundtrack, on models that support audio. The audio tier costs more per second, and each model sets its own default.
Model-specific. What to avoid in the output, on models that support it.
Model-specific. Seed for reproducible output. Omit for a random seed.
Response
The created video job.
A video generation job.
The job id. Pass it to the retrieve, content, and delete endpoints.
Object type, always video.
"video"
The video model id you requested.
Lifecycle state of the job.
queued, in_progress, completed, failed The resolution the job bills at.
The clip length the job bills at, in seconds.
Unix timestamp when the job was created.
Unix timestamp when the job completed.
The generated video, present when status is completed.
Show child attributes
Show child attributes
Present when status is failed. Explains the failure; the job is not charged.
Show child attributes
Show child attributes
Was this page helpful?