PicassoIA Reference To Video का मॉडल ID picassoia/picassoia-reference-to-video है। रेफ़रेंस से वीडियो: ऑडियो, 1 से 15 सेकंड की क्लिप और 480p या 720p आउटपुट।
API को कॉल करना
https://api.picassoia.com/v1/models/picassoia/picassoia-reference-to-video/predictions पर ऐसी JSON बॉडी के साथ रिक्वेस्ट भेजें जिसका input नीचे दिए गए पैरामीटर से मेल खाता हो।
सेटअप
अपनी API key अपने सर्वर पर किसी एनवायरनमेंट वेरिएबल में रखें, और उसे हर रिक्वेस्ट के Authorization हेडर में भेजें।
export PICASSOIA_API_KEY="pia_sk_…"रिक्वेस्ट पैरामीटर
promptstringज़रूरी- डिफ़ॉल्टकोई नहीं
- आउटपुट में क्या दिखना चाहिए। 8000 कैरेक्टर तक।
imagesarray- डिफ़ॉल्टकोई नहीं
- वे इमेज जिन्हें एडिट करना या आपस में जोड़ना है। प्रॉम्प्ट में उनका ज़िक्र image 1, image 2 वगैरह के रूप में करें। 1 से 9 इमेज। इन फ़ील्ड में से कम से कम एक भेजना ज़रूरी है: images या video। PNG, JPEG या WebP इमेज, सार्वजनिक https URL या 5 MB तक के data URL के रूप में।
videostring- डिफ़ॉल्टकोई नहीं
- वह वीडियो जिसे आधार बनाना है। इन फ़ील्ड में से कम से कम एक भेजना ज़रूरी है: images या video। 50 MB तक का MP4, MOV या WebM वीडियो, सार्वजनिक https URL के रूप में।
audiostring- डिफ़ॉल्टकोई नहीं
- वह ऑडियो जिसे आधार बनाना है। 20 MB तक की MP3, WAV, M4A, AAC, OGG या FLAC फ़ाइल, सार्वजनिक https URL के रूप में।
resolutionstring- डिफ़ॉल्ट
"480p" - आउटपुट का साइज़। विकल्प: 480p और 720p।
durationinteger- डिफ़ॉल्ट
5 - क्लिप की लंबाई, सेकंड में। 1 से 15 तक।
aspect_ratiostring- डिफ़ॉल्ट
"match_input_image" / "16:9" - आउटपुट का आकार। जहाँ match_input_image का विकल्प हो, वहाँ यह इनपुट इमेज का अनुपात बनाए रखता है, या कई इमेज होने पर पहली इमेज का। विकल्प: match_input_image, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 और 1:1। न भेजने पर: video भेजने पर match_input_image, न भेजने पर 16:9।
video_strengthstring- डिफ़ॉल्ट
"high" - क्लिप रेफ़रेंस वीडियो का कितनी बारीकी से पालन करे। विकल्प: high, medium और low। इसके लिए video फ़ील्ड ज़रूरी है।
save_audioboolean- डिफ़ॉल्ट
true - जनरेट किया गया ऑडियो ट्रैक रखें।
seedinteger- डिफ़ॉल्टकोई नहीं
- किसी नतीजे को दोबारा पाने के लिए इसे सेट करें; रैंडम नतीजे के लिए इसे छोड़ दें।
enhance_promptboolean- डिफ़ॉल्ट
true - बेहतर नतीजे के लिए Picasso IA आपका प्रॉम्प्ट दोबारा लिखता है। आपका अपना प्रॉम्प्ट इनपुट में ही रहता है।
मोड
मोड इस पर निर्भर करता है कि आप प्रॉम्प्ट के साथ कोई फ़ाइल भेजते हैं या नहीं, और कौन-सी। हर मोड एक ही एंडपॉइंट इस्तेमाल करता है।
उदाहरण रिक्वेस्ट
रेफ़रेंस से वीडियो
curl -s -X POST https://api.picassoia.com/v1/models/picassoia/picassoia-reference-to-video/predictions \
-H "Authorization: Bearer $PICASSOIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":{"prompt":"Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.","images":["https://example.com/woman.jpg","https://example.com/cafe.jpg"]}}'const API = 'https://api.picassoia.com/v1'
const headers = {
Authorization: `Bearer ${process.env.PICASSOIA_API_KEY}`,
'Content-Type': 'application/json',
}
const sleep = (s) => new Promise((resolve) => setTimeout(resolve, s * 1000))
const input = {
prompt: "Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.",
images: [
"https://example.com/woman.jpg",
"https://example.com/cafe.jpg"
]
}
const created = await fetch(`${API}/models/picassoia/picassoia-reference-to-video/predictions`, {
method: 'POST',
headers,
body: JSON.stringify({ input }),
})
let prediction = await created.json()
if (!created.ok) throw new Error(`${prediction.code}: ${prediction.detail}`)
while (!['succeeded', 'failed', 'canceled'].includes(prediction.status)) {
await sleep(prediction.eta?.next_poll_in_seconds ?? 2)
prediction = await (await fetch(prediction.urls.get, { headers })).json()
}
if (prediction.status !== 'succeeded') throw new Error(prediction.error ?? prediction.status)
console.log(prediction.output)import os, time, requests
API = "https://api.picassoia.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['PICASSOIA_API_KEY']}"}
payload = {"input": {
"prompt": "Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.",
"images": [
"https://example.com/woman.jpg",
"https://example.com/cafe.jpg",
],
}}
response = requests.post(f"{API}/models/picassoia/picassoia-reference-to-video/predictions", json=payload, headers=HEADERS)
prediction = response.json()
if not response.ok:
raise RuntimeError(f"{prediction['code']}: {prediction['detail']}")
while prediction["status"] not in ("succeeded", "failed", "canceled"):
time.sleep((prediction.get("eta") or {}).get("next_poll_in_seconds", 2))
prediction = requests.get(prediction["urls"]["get"], headers=HEADERS).json()
if prediction["status"] != "succeeded":
raise RuntimeError(prediction["error"] or prediction["status"])
print(prediction["output"])प्रमाणीकरण
हर रिक्वेस्ट के Authorization हेडर में Bearer टोकन के रूप में एक API key होनी चाहिए। अपने अकाउंट में keys बनाएँ; पूरी key सिर्फ़ एक बार दिखाई जाती है।
Authorization: Bearer $PICASSOIA_API_KEYकतार और पोलिंग
हर प्रेडिक्शन में तीन स्टेप होते हैं: उसे बनाएँ, पूरा होने तक पोल करें, फिर नतीजा पढ़ें।
भेजना
API आमतौर पर कुछ ही सेकंड में 201 के साथ जवाब देता है, जिसमें प्रेडिक्शन starting स्टेट में होता है, eta में एक अनुमान होता है और urls.get में पोल करने का URL होता है। अगर प्रेडिक्शन तुरंत फ़ेल हो जाता है, जैसे जब सेफ़्टी फ़िल्टर इनपुट को अस्वीकार कर देता है, तब भी जवाब 201 ही होता है, जिसमें प्रेडिक्शन failed स्टेट में और अपने error के साथ होता है।
curl -s -X POST https://api.picassoia.com/v1/models/picassoia/picassoia-reference-to-video/predictions \
-H "Authorization: Bearer $PICASSOIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":{"prompt":"Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.","images":["https://example.com/woman.jpg","https://example.com/cafe.jpg"]}}'const API = 'https://api.picassoia.com/v1'
const headers = {
Authorization: `Bearer ${process.env.PICASSOIA_API_KEY}`,
'Content-Type': 'application/json',
}
const input = {
prompt: "Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.",
images: [
"https://example.com/woman.jpg",
"https://example.com/cafe.jpg"
]
}
const created = await fetch(`${API}/models/picassoia/picassoia-reference-to-video/predictions`, {
method: 'POST',
headers,
body: JSON.stringify({ input }),
})
let prediction = await created.json()
if (!created.ok) throw new Error(`${prediction.code}: ${prediction.detail}`)
console.log(prediction.id, prediction.status) // api_…, startingimport os, requests
API = "https://api.picassoia.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['PICASSOIA_API_KEY']}"}
payload = {"input": {
"prompt": "Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.",
"images": [
"https://example.com/woman.jpg",
"https://example.com/cafe.jpg",
],
}}
response = requests.post(f"{API}/models/picassoia/picassoia-reference-to-video/predictions", json=payload, headers=HEADERS)
prediction = response.json()
if not response.ok:
raise RuntimeError(f"{prediction['code']}: {prediction['detail']}")
print(prediction["id"], prediction["status"]) # api_…, starting{
"id": "api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60",
"model": "picassoia/picassoia-reference-to-video",
"input": {
"prompt": "Image 1, the woman with red hair, walks into Image 2, the cafe, and sits by the window. Soft cafe ambience.",
"images": [
"https://example.com/woman.jpg",
"https://example.com/cafe.jpg"
],
"resolution": "480p",
"duration": 5,
"aspect_ratio": "16:9",
"save_audio": true,
"enhance_prompt": true
},
"output": null,
"error": null,
"status": "starting",
"created_at": "2026-10-01T09:30:00.000Z",
"started_at": null,
"completed_at": null,
"metrics": {
"predict_time": null
},
"urls": {
"get": "https://api.picassoia.com/v1/predictions/api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60",
"cancel": "https://api.picassoia.com/v1/predictions/api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60/cancel"
},
"eta": {
"seconds": 60,
"next_poll_in_seconds": 30
}
}पोल करना
eta.next_poll_in_seconds के बाद urls.get को फिर से पोल करें: अनुमानित समय के आधे पर, अनुमानित समय पूरा होने पर, फिर हर 2 सेकंड में।
# Repeat after eta.next_poll_in_seconds until status is
# succeeded, failed or canceled.
curl -s https://api.picassoia.com/v1/predictions/api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60 \
-H "Authorization: Bearer $PICASSOIA_API_KEY"const sleep = (s) => new Promise((resolve) => setTimeout(resolve, s * 1000))
while (!['succeeded', 'failed', 'canceled'].includes(prediction.status)) {
await sleep(prediction.eta?.next_poll_in_seconds ?? 2)
prediction = await (await fetch(prediction.urls.get, { headers })).json()
}import time
while prediction["status"] not in ("succeeded", "failed", "canceled"):
time.sleep((prediction.get("eta") or {}).get("next_poll_in_seconds", 2))
prediction = requests.get(prediction["urls"]["get"], headers=HEADERS).json(){
"id": "api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60",
"status": "processing",
"output": null,
"eta": {
"seconds": 30,
"next_poll_in_seconds": 30
}
}नतीजा
जब status succeeded होता है, तो output में नतीजा होता है। अगर प्रेडिक्शन failed है, तो error में उसका कारण होता है, और canceled प्रेडिक्शन पूरा होने से पहले रोक दिया गया था। ये तीनों स्टेटस अंतिम हैं।
# The last poll holds the result: "output" when "status" is succeeded,
# "error" when it is failed. With jq, just those three fields:
curl -s https://api.picassoia.com/v1/predictions/api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60 \
-H "Authorization: Bearer $PICASSOIA_API_KEY" | jq '.status, .output, .error'if (prediction.status !== 'succeeded') throw new Error(prediction.error ?? prediction.status)
console.log(prediction.output)if prediction["status"] != "succeeded":
raise RuntimeError(prediction["error"] or prediction["status"])
print(prediction["output"]){
"id": "api_3f9c2b7e8d1a4c6f9e0b1a2c3d4e5f60",
"status": "succeeded",
"output": "https://…/output.mp4",
"error": null,
"completed_at": "2026-10-01T09:30:54.000Z",
"metrics": {
"predict_time": 52.8
},
"eta": null
}रद्द करना
POST urls.cancel ऐसे प्रेडिक्शन को रोक देता है जो अभी कतार में है (कोई भी मॉडल) या ऐसी इमेज को जो अभी जनरेट हो रही है; जो वीडियो पहले से जनरेट हो रहा है, उसके लिए जवाब 409 not_cancelable होता है।
इन जवाबों में दिए गए ID, समय और URL उदाहरण हैं: आपके जवाबों में आपके अपने होंगे।
आउटपुट
प्रेडिक्शन सफल होने पर output एक MP4 वीडियो का URL होता है।
त्रुटियाँ और सीमाएँ
त्रुटियाँ स्थिर code वाले JSON problem details के रूप में आती हैं, और 422 जवाब में हर गलत फ़ील्ड का नाम होता है।
सीमाएँ
- हर अकाउंट पर एक साथ 5 प्रेडिक्शन, कतार में या चलते हुए
- रिक्वेस्ट बॉडी 10 MB तक; data URL के रूप में इमेज, हर एक 5 MB तक
- प्रॉम्प्ट 8000 कैरेक्टर तक
- अज्ञात फ़ील्ड 422 invalid_input के साथ अस्वीकार किए जाते हैं
कीमत
सक्रिय Infinite प्लान के साथ $0 प्रति रिक्वेस्ट: सेटिंग्स चाहे जो हों, API प्रेडिक्शन में कोई क्रेडिट खर्च नहीं होता।
API की कीमतJSON Schema
वही स्कीमा जो API GET /v1/models/picassoia/picassoia-reference-to-video पर देता है।
{
"input_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"prompt": {
"type": "string",
"minLength": 1,
"maxLength": 8000,
"description": "What happens in the video and what is heard. Name the references: \"Image 1\", \"Video 1\", \"Audio 1\"."
},
"images": {
"description": "Up to 9 reference images (characters, objects, places), in the order of \"Image 1\", \"Image 2\"… At least one image or a video is required.",
"maxItems": 9,
"type": "array",
"items": {
"type": "string",
"description": "A reference image: an https URL or a data URL."
}
},
"video": {
"type": "string",
"description": "Reference video: an https URL (MP4, MOV or WebM, up to 50 MB; its first 15 s are used). The clip follows its movement, camera and timing, keeps its sound unless an audio is sent, and lasts as long as the video, or duration if that is shorter. To put your own character in it, say who replaces whom (\"Image 1 replaces the woman in Video 1\") and what they do."
},
"audio": {
"type": "string",
"description": "Reference audio: an https URL (MP3, WAV, M4A, AAC, OGG or FLAC, up to 20 MB). A voice a character says with lip sync (\"Image 1 says Audio 1\"), or music. It is heard as it is. Lip sync is most exact in clips of up to 5 s."
},
"resolution": {
"default": "480p",
"description": "480p or 720p, both up to 15 s.",
"type": "string",
"enum": [
"480p",
"720p"
]
},
"duration": {
"default": 5,
"description": "Length in seconds.",
"type": "integer",
"minimum": 1,
"maximum": 15
},
"aspect_ratio": {
"description": "Default: 16:9, or the reference video's when there is one. match_input_image follows the video if there is one, otherwise the first image.",
"type": "string",
"enum": [
"match_input_image",
"16:9",
"9:16",
"4:3",
"3:4",
"3:2",
"2:3",
"1:1"
]
},
"video_strength": {
"description": "Only with a video: how closely the clip follows it. high (the default) follows its camera, composition and timing most closely; medium and low follow it more loosely and render faster.",
"type": "string",
"enum": [
"high",
"medium",
"low"
]
},
"save_audio": {
"default": true,
"description": "Keep the generated audio track.",
"type": "boolean"
},
"seed": {
"description": "Random seed. Set it to reproduce a result.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"enhance_prompt": {
"default": true,
"description": "Let PicassoIA rewrite the prompt for a better video before generating it.",
"type": "boolean"
}
},
"required": [
"prompt"
],
"additionalProperties": false
},
"output_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
"format": "uri",
"description": "URL of the generated video (MP4)."
}
}