GetVibe अपने text model APIs के साथ asynchronous job API के माध्यम से media generation उपलब्ध कराता है। Media request path, OpenAI chat completions जैसा नहीं है: generation job submit करें, job ID प्राप्त करें, और उसका status व result retrieve करें। Image, video और audio/voice models के inputs और billing units अलग-अलग होते हैं, इसलिए यह मानने के बजाय कि हर model के लिए एक ही request shape काम करेगी, media model catalog में से चुनें।
Model खोजें और उसकी requirements जाँचें
अपने account के लिए उपलब्ध media types देखने हेतु media catalog और /v1/models?type=image,video,audio का उपयोग करें। हर model की exact ID, स्वीकार किए जाने वाले input, supported options, output format और price unit जाँचें। कोई image model output settings के आधार पर charge कर सकता है; video duration और resolution पर निर्भर हो सकता है; voice models text length, duration या किसी अन्य documented unit के आधार पर bill कर सकते हैं। इन prices की तुलना ऐसे न करें जैसे सभी text tokens हों।
gpt-image-2 catalog में मौजूद एक image model है। इसका model page और media docs supported aspect ratios, resolution और generation/edit options की सूची देते हैं। Video models के inputs अलग होते हैं और उन्हें अधिक समय लग सकता है। Voice features model के अनुसार बदलते हैं; अपने UI में किसी खास operation का वादा करने से पहले वर्तमान media listing की पुष्टि करें।
Image job submit करें
Key को अपने server पर रखें। Text-to-image request के लिए यह documented asynchronous shape है: prompt top-level field होता है और generation options opts के अंदर होते हैं।
curl https://getvibeapi.com/api/media/generate \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Developer desk का एक साफ़-सुथरा editorial illustration, कोई text नहीं",
"opts": {"aspect_ratio":"16:9", "resolution":"1K", "mode":"text-to-image"}
}'लौटाए गए jobId को अपने user और task record के साथ persist करें। यह request generation शुरू करती है; finished image body inline return नहीं करती।
Poll करें या webhook प्राप्त करें
छोटे integration के लिए job endpoint को moderate interval पर poll करें और job के terminal state तक पहुँचने पर रुक जाएँ। States में submitting, processing, success, fail और expired शामिल हैं। हर कुछ milliseconds में polling करने से traffic बढ़ता है, generation तेज़ नहीं होती। Production batches के लिए documented webhook configure करें और callback को idempotent बनाएँ, ताकि duplicate deliveries से duplicate assets न बनें।
curl "https://getvibeapi.com/api/media/jobs/$JOB_ID" \
-H "Authorization: Bearer $GETVIBE_API_KEY"Success पर result URLs retrieve करें और यदि long-term retention आवश्यक हो तो media को अपने नियंत्रण वाले storage में copy करें। Failure होने पर support के लिए job ID रखें और उपयोगी error दिखाएँ। हर failure को retry न करें: invalid option फिर से fail होगा और duplicate generation पर अतिरिक्त charge लग सकता है।
Video और voice के लिए model-specific handling आवश्यक है
Video के लिए submit करने से पहले model की duration, frame size, image-conditioning requirements और supported options जाँचें। Remote source URLs को validate करें और सुनिश्चित करें कि वे reachable हों। Job progress दिखाई देती रहे, क्योंकि rendering में text generation से अधिक समय लग सकता है। Batches के लिए interactive page खुला रखने के बजाय documented webhook flow का उपयोग करें।
Voice और audio के लिए speech generation को transcription या audio understanding से अलग समझें। इनके input और output modalities अलग-अलग होते हैं। Endpoint और payload को model card के अनुसार रखें, जहाँ उपलब्ध हो वहाँ text या duration limits सेट करें, और लौटाए गए audio को ऐसे format में store करें जिसे आपका player स्वीकार करता हो। यह वादा न करें कि हर media model voice produce कर सकता है।
Budget और failure behavior
Batch शुरू करने से पहले media model की current price जाँचें और उसके actual billing unit में estimate लगाएँ। Text model की price image या video generation की proxy नहीं है। Production में उपयोग की जाने वाली exact resolution, duration या voice settings के साथ एक sample चलाएँ। Job ID, model, options, duration, terminal state और charged usage record करें। महँगे या customer-facing outputs के लिए maximum batch size और manual review सेट करें।
जब तक आपकी privacy policy इसकी अनुमति न दे, prompts और media URLs को general logs से बाहर रखें। Credentials को redact करें, upload limits लागू करें और private generated assets को public URLs के रूप में expose करने से बचें। Edits के लिए result की समीक्षा होने तक original asset को अलग से सुरक्षित रखें।
Production से पहले checklist
- Exact model ID, modality और input requirements की पुष्टि करें।
- API key को server पर रखें।
- Documented top-level prompt और model-specific options का उपयोग करें।
- Job IDs persist करें और polling/webhook handling को idempotent बनाएँ।
- Failure और expiration behavior परिभाषित करें।
- Model के actual billing unit के आधार पर budget बनाएँ।
- यदि successful outputs को persist करना है, तो उन्हें storage में copy करें।
Ship करने से पहले media generation, media webhooks और media models पढ़ें। Public model list और supported options बदल सकते हैं; आपके account के लिए वे pages और live catalog ही reference हैं।
Source assets को सुरक्षित रूप से handle करें
Image-to-image या image-conditioned video के लिए उस model के documentation में बताए गए upload या URL method का उपयोग करें। पुष्टि करें कि source URL generation service द्वारा publicly reachable है और इसके लिए आपके logged-in browser session की आवश्यकता नहीं है। Prompts में लंबे समय तक मान्य signed URLs embed करने से बचें, क्योंकि उन्हें logs में copy किया जा सकता है। User files स्वीकार करने से पहले अपने application में upload size और content-type checks लागू करें।
User-provided image से generation करते समय original file सुरक्षित रखें और consent व retention requirements track करें। Generated result में source की पहचान योग्य details हो सकती हैं; उसे share करने से पहले अपने product के privacy और moderation rules लागू करें।
UI को job states के अनुसार design करें
Job ID लौटने के बाद submitted state, service के काम करने के दौरान processing state और success, failure या expiration के लिए स्पष्ट terminal states दिखाएँ। यदि job asynchronous रूप से जारी रहती है, तो users को सुरक्षित रूप से navigate away करने दें और फिर अपने stored job record को lookup करके status restore करें। Duplicate work submit होने से रोकने के लिए submit control disable करें या अपना idempotency guard उपयोग करें।
Batch के लिए completed, failed और pending counts अलग-अलग दिखाएँ। एक single aggregate spinner यह संकेत नहीं देता कि कोई लंबा video job ठीक चल रहा है या अटक गया है। Bounded polling backoff रखें और batch बढ़ने पर documented webhook path पर switch करें।
Retention plan के साथ results store करें
Returned result URL को permanent storage न मानें, जब तक media documentation ऐसा न कहे। जब long-term access आवश्यक हो, तो successful output को अपने storage bucket में download करें और फिर नया object ID अपने database में save करें। Generated files पर access control लागू करें और user द्वारा project हटाने पर deletion behavior परिभाषित करें।
Model ID, options, prompt version, job ID, result object, terminal status और billed usage record करें। इससे बाद में आने वाले support question का उत्तर full sensitive prompt log किए बिना या media URL को पूरी team के सामने expose किए बिना दिया जा सकता है।
