# ─────────────────────────────────────────
# Case 1: JSON body — text / image URL / audio URL (or all together)
# Remove "image" and/or "audio" keys if not needed
# When "image" present → aspect_ratio ignored
# When "audio" present → duration ignored
# ─────────────────────────────────────────
curl -X POST "https://platform.qubrid.com/v1/videos/generations" \
-H "Authorization: Bearer QUBRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "p-video",
"prompt": "A butterfly flying through a flower garden",
"duration": 5,
"resolution": "720p",
"fps": 24,
"aspect_ratio": "16:9",
"image": "https://example.com/input-image.jpg",
"audio": "https://example.com/audio.mp3",
"draft": false,
"save_audio": true,
"prompt_upsampling": true
}'
# ─────────────────────────────────────────
# Case 2: File upload — image_file + audio_file (multipart)
# Remove either -F line if only one file is needed
# ─────────────────────────────────────────
curl -X POST "https://platform.qubrid.com/v1/videos/generations" \
-H "Authorization: Bearer QUBRID_API_KEY" \
-F "model=p-video" \
-F "prompt=A butterfly flying through a flower garden" \
-F "duration=5" \
-F "resolution=720p" \
-F "fps=24" \
-F "draft=false" \
-F "save_audio=true" \
-F "prompt_upsampling=true" \
-F "image_file=@/path/to/your/image.jpg" \
-F "audio_file=@/path/to/your/audio.mp3"
# ─────────────────────────────────────────
# Tip: pass image/audio as URL via form fields (no file upload needed)
# ─────────────────────────────────────────
curl -X POST "https://platform.qubrid.com/v1/videos/generations" \
-H "Authorization: Bearer QUBRID_API_KEY" \
-F "model=p-video" \
-F "prompt=A butterfly flying through a flower garden" \
-F "image=https://example.com/input-image.jpg" \
-F "audio=https://example.com/audio.mp3" \
-F "resolution=720p" \
-F "fps=24" \
-F "draft=false" \
-F "save_audio=true" \
-F "prompt_upsampling=true"
import requests
url = "https://platform.qubrid.com/v1/videos/generations"
headers = {"Authorization": "Bearer QUBRID_API_KEY"}
# ─────────────────────────────────────────
# Case 1: JSON body — image URL + audio URL
# Works with text-only, image-only, audio-only, or both
# ─────────────────────────────────────────
response = requests.post(
url,
headers={**headers, "Content-Type": "application/json"},
json={
"model": "p-video",
"prompt": "A butterfly flying through a flower garden",
"duration": 5,
"resolution": "720p",
"fps": 24,
"aspect_ratio": "16:9",
"image": "https://example.com/input-image.jpg", # optional
"audio": "https://example.com/audio.mp3", # optional
"draft": False,
"save_audio": True,
"prompt_upsampling": True,
},
)
print(response.json())
# ─────────────────────────────────────────
# Case 2: File upload — image_file + audio_file (multipart)
# Remove either file entry if not needed
# ─────────────────────────────────────────
with open("/path/to/your/image.jpg", "rb") as img, \
open("/path/to/your/audio.mp3", "rb") as aud:
response = requests.post(
url,
headers=headers,
data={
"model": "p-video",
"prompt": "A butterfly flying through a flower garden",
"duration": "5",
"resolution": "720p",
"fps": "24",
"draft": "false",
"save_audio": "true",
"prompt_upsampling": "true",
},
files={
"image_file": img, # remove if not needed
"audio_file": aud, # remove if not needed
},
)
print(response.json())
# ─────────────────────────────────────────
# Tip: pass image/audio as URL via form fields (no file needed)
# files={} is required to force multipart/form-data
# ─────────────────────────────────────────
response = requests.post(
url,
headers=headers,
data={
"model": "p-video",
"prompt": "A butterfly flying through a flower garden",
"image": "https://example.com/input-image.jpg", # optional
"audio": "https://example.com/audio.mp3", # optional
"resolution": "720p",
"fps": "24",
"draft": "false",
"save_audio": "true",
"prompt_upsampling": "true",
},
files={}, # forces multipart/form-data — do not remove
)
print(response.json())
import fs from "fs";
// ─────────────────────────────────────────
// Case 1: JSON body — text / image URL / audio URL (or all together)
// Remove "image" and/or "audio" keys if not needed
// When "image" present → aspect_ratio ignored
// When "audio" present → duration ignored
// ─────────────────────────────────────────
const response1 = await fetch("https://platform.qubrid.com/v1/videos/generations", {
method: "POST",
headers: {
Authorization: "Bearer QUBRID_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "p-video",
prompt: "A butterfly flying through a flower garden",
duration: 5,
resolution: "720p",
fps: 24,
aspect_ratio: "16:9",
image: "https://example.com/input-image.jpg", // optional
audio: "https://example.com/audio.mp3", // optional
draft: false,
save_audio: true,
prompt_upsampling: true,
}),
});
const result1 = await response1.json();
console.log(result1.data[0].video_url);
// ─────────────────────────────────────────
// Case 2: File upload — image_file + audio_file (multipart)
// Remove either append line if only one file is needed
// ─────────────────────────────────────────
const form = new FormData();
form.append("model", "p-video");
form.append("prompt", "A butterfly flying through a flower garden");
form.append("duration", "5");
form.append("resolution", "720p");
form.append("fps", "24");
form.append("draft", "false");
form.append("save_audio", "true");
form.append("prompt_upsampling", "true");
form.append("image_file", fs.createReadStream("/path/to/your/image.jpg")); // remove if not needed
form.append("audio_file", fs.createReadStream("/path/to/your/audio.mp3")); // remove if not needed
const response2 = await fetch("https://platform.qubrid.com/v1/videos/generations", {
method: "POST",
headers: { Authorization: "Bearer QUBRID_API_KEY" },
body: form,
});
const result2 = await response2.json();
console.log(result2.data[0].video_url);
// ─────────────────────────────────────────
// Tip: pass image/audio as URL via form fields (no file upload needed)
// ─────────────────────────────────────────
const form2 = new FormData();
form2.append("model", "p-video");
form2.append("prompt", "A butterfly flying through a flower garden");
form2.append("image", "https://example.com/input-image.jpg"); // optional
form2.append("audio", "https://example.com/audio.mp3"); // optional
form2.append("resolution", "720p");
form2.append("fps", "24");
form2.append("draft", "false");
form2.append("save_audio", "true");
form2.append("prompt_upsampling", "true");
const response3 = await fetch("https://platform.qubrid.com/v1/videos/generations", {
method: "POST",
headers: { Authorization: "Bearer QUBRID_API_KEY" },
body: form2,
});
const result3 = await response3.json();
console.log(result3.data[0].video_url);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://platform.qubrid.com/v1/videos/generations"
// ─────────────────────────────────────────
// Case 1: JSON body — text / image URL / audio URL (or all together)
// Remove Image/Audio fields if not needed
// When Image present → AspectRatio ignored
// When Audio present → Duration ignored
// ─────────────────────────────────────────
type VideoRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
Duration int `json:"duration"`
Resolution string `json:"resolution"`
FPS int `json:"fps"`
AspectRatio string `json:"aspect_ratio"`
Image string `json:"image,omitempty"`
Audio string `json:"audio,omitempty"`
Draft bool `json:"draft"`
SaveAudio bool `json:"save_audio"`
PromptUpsampling bool `json:"prompt_upsampling"`
}
jsonPayload := VideoRequest{
Model: "p-video",
Prompt: "A butterfly flying through a flower garden",
Duration: 5,
Resolution: "720p",
FPS: 24,
AspectRatio: "16:9",
Image: "https://example.com/input-image.jpg", // optional — remove if not needed
Audio: "https://example.com/audio.mp3", // optional — remove if not needed
Draft: false,
SaveAudio: true,
PromptUpsampling: true,
}
jsonData, _ := json.Marshal(jsonPayload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer QUBRID_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
fmt.Println(resp.Status)
// ─────────────────────────────────────────
// Case 2: File upload — image_file + audio_file (multipart)
// Remove either block if only one file is needed
// ─────────────────────────────────────────
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
writer.WriteField("model", "p-video")
writer.WriteField("prompt", "A butterfly flying through a flower garden")
writer.WriteField("duration", "5")
writer.WriteField("resolution", "720p")
writer.WriteField("fps", "24")
writer.WriteField("draft", "false")
writer.WriteField("save_audio", "true")
writer.WriteField("prompt_upsampling", "true")
imgFile, _ := os.Open("/path/to/your/image.jpg") // remove if not needed
imgPart, _ := writer.CreateFormFile("image_file", "image.jpg")
io.Copy(imgPart, imgFile)
audFile, _ := os.Open("/path/to/your/audio.mp3") // remove if not needed
audPart, _ := writer.CreateFormFile("audio_file", "audio.mp3")
io.Copy(audPart, audFile)
writer.Close()
req2, _ := http.NewRequest("POST", url, body)
req2.Header.Set("Authorization", "Bearer QUBRID_API_KEY")
req2.Header.Set("Content-Type", writer.FormDataContentType())
resp2, _ := client.Do(req2)
fmt.Println(resp2.Status)
// ─────────────────────────────────────────
// Tip: pass image/audio as URL via form fields (no file upload needed)
// ─────────────────────────────────────────
body3 := &bytes.Buffer{}
writer3 := multipart.NewWriter(body3)
writer3.WriteField("model", "p-video")
writer3.WriteField("prompt", "A butterfly flying through a flower garden")
writer3.WriteField("image", "https://example.com/input-image.jpg") // optional
writer3.WriteField("audio", "https://example.com/audio.mp3") // optional
writer3.WriteField("resolution", "720p")
writer3.WriteField("fps", "24")
writer3.WriteField("draft", "false")
writer3.WriteField("save_audio", "true")
writer3.WriteField("prompt_upsampling", "true")
writer3.Close()
req3, _ := http.NewRequest("POST", url, body3)
req3.Header.Set("Authorization", "Bearer QUBRID_API_KEY")
req3.Header.Set("Content-Type", writer3.FormDataContentType())
resp3, _ := client.Do(req3)
fmt.Println(resp3.Status)
}