Rivya Journal

Rivya API के साथ multimodal workflow बनाएं

Models, files, generation jobs, chat turns, webhooks, credits और product review handoff तक फैला Rivya API workflow plan करें।
वर्कफ़्लो
प्रकाशित 2026/05/12अंतिम समीक्षा 2026/05/12लेखक:Rivya संपादकीय टीम
Model selection, file upload, generation jobs, chat turns, webhooks और account credits को एक product pipeline में दिखाता Rivya API workflow cover।

एक अच्छा Rivya API integration सिर्फ एक model को एक request भेजना नहीं होता।

ज्यादातर real product workflows में एक छोटी chain होती है: सही model चुनना, input prepare करना, जरूरत हो तो reference files upload करना, task submit करना, status watch करना, credits handle करना और result ready होने पर product को notify करना।

यह article planning shape दिखाता है। Shortest runnable path के लिए Rivya API Quickstart use करें, और exact request fields के लिए API docs use करें।

Product moment से शुरू करें

Endpoints चुनने से पहले product moment को एक sentence में describe करें।

Examples:

  • Seller listing brief submit करे तो product image draft create करें।
  • Campaign manager still direction approve करे तो short video concept generate करें।
  • Internal research tool में chat turn भेजें और response user को stream करें।
  • Reference image upload करें, supported model request submit करें और result ready होने पर user को notify करें।

यह sentence integration को loose API calls की collection बनने से रोकता है।

Code लिखने से पहले workflow map करें

Request schema खोलने से पहले इस table का use करें।

Workflow stepProduct questionAPI area
Account accessUsage किस Rivya account के पास रहेगा?API Authentication
Model choiceकौन सा public model ID इस task में fit बैठता है?API Models
Reference inputक्या model को uploaded media चाहिए?Files API
Generationक्या यह async image, video या audio task है?Create Generation
Chatक्या यह generation task के बजाय chat model turn है?Chat API
StatusProduct को result ready होने का पता कैसे चलेगा?Generation Status
Completion eventक्या दूसरे system को signed callback चाहिए?API Webhooks
CreditsTeam cost को कैसे समझेगी?API Credits

Workflow इतना clear होना चाहिए कि हर API area के पास मौजूद होने का reason हो।

Step 1: Integration के लिए key create करें

उस specific app, environment या workflow के लिए API key create करें जो इसे use करेगा।

हर चीज के लिए one key use करने से बचें। Keys को purpose से name करने पर बाद में review आसान होता है:

  • production-image-workflow
  • staging-video-tests
  • internal-chat-assistant
  • webhook-smoke-test

Key store करने से पहले API Authentication पढ़ें। Full secret सिर्फ एक बार shown होता है, इसलिए आपकी team को इसे तुरंत सही server-side secret store में save करना चाहिए।

Step 2: Public API list से models चुनें

किसी model को सिर्फ इसलिए hard-code न करें कि वह manual test में काम कर गया था।

API Models और Model API Reference से confirm करें:

  • public model ID
  • क्या यह API through available है
  • supported input mode
  • prompt और parameter expectations
  • क्या Files API required है
  • credit behavior और readiness notes

यहां कई integrations cleaner हो जाते हैं। Manual Studio test के लिए perfect model automated product flow का right first model नहीं भी हो सकता।

Step 3: Decide करें कि first version में Files API चाहिए या नहीं

अगर model text input से run कर सकता है, तो first version text-only रखें।

Files API तभी add करें जब workflow को सच में reference media चाहिए।

जब चाहिए, define करें:

  • product कौन से file kinds accept करता है
  • file cleanup step किसके पास है
  • upload fail होने पर क्या होता है
  • returned file data model parameters में कैसे pass होता है
  • same file reuse होगी या फिर upload होगी

इससे fragile file experience clean-looking generate button के पीछे hide नहीं होता।

Step 4: One generation task submit करें

Image, video और audio generation के लिए normal pattern यह है:

  1. model ID, prompt और supported params prepare करें
  2. safe retries के लिए idempotency key add करें
  3. generation endpoint से submit करें
  4. public task ID save करें
  5. task terminal state तक पहुंचे, तब तक status poll करें

Request shape के लिए Create Generation और result handling के लिए Generation Status use करें।

Product को queued, processing, succeeded और failed को user-facing states की तरह treat करना चाहिए। Users से system details पढ़वाएं नहीं, और उन्हें यह guess न करने दें कि task slow क्यों है।

Step 5: Chat models के लिए Chat API use करें

Chat models को Chat API use करना चाहिए, generation endpoint नहीं।

यह इसलिए matter करता है क्योंकि chat work का behavior अलग होता है:

  • chat turns API-created sessions से belong कर सकते हैं
  • non-streaming और SSE streaming की user experience अलग होती है
  • image attachments Files API से मिले file IDs use करते हैं
  • credit settlement normal async media task के बजाय chat turn follow करता है

अगर product को अपने interface के अंदर assistant answer चाहिए, Chat API right path हो सकता है। अगर user अभी ideas explore कर रहा है, Rivya Chat या Studio बेहतर हो सकता है।

Step 6: Polling से शुरू करें, फिर webhooks add करें

First version के लिए polling reason करना आसान है।

API Webhooks तब add करें जब:

  • product के पास कई async jobs हों
  • waiting clients को direct poll नहीं करना चाहिए
  • downstream systems को signed completion events चाहिए
  • retry और duplicate handling पहले से designed हो

Webhook receivers boring और strict होने चाहिए: signature verify करें, duplicate-safe events accept करें, one product record update करें और सिर्फ safe loggable details log करें।

Step 7: Credits को product में visible बनाएं

Rivya API Studio वाले same account credits use करता है।

आपका integration decide करे कि इसमें से कितना दिखाना है। Minimum पर team को पता होना चाहिए:

  • API key किस account के पास है
  • कौन सा workflow credits consume कर सकता है
  • credits too low होने पर क्या होता है
  • failed generation states कैसे explain होती हैं
  • credit और billing questions के लिए user को कहां भेजना है

User-facing wallet model के लिए API Credits, Credits & Billing in Rivya और How to Think About Rivya Credits, Packs, and Plans use करें।

Small first version

एक अच्छा first version intentionally limited होता है।

उदाहरण:

  1. one API key
  2. one selected image model
  3. अभी file upload नहीं
  4. one generation request
  5. one status polling path
  6. आपके product में one simple result preview
  7. one clear credit error message

यह version ज्यादा moving parts add करने से पहले connection prove करता है।

More complete version

First version काम करने के बाद fuller workflow ये add कर सकता है:

  • reference images या videos के लिए Files API
  • model-specific parameter controls
  • आपके product record से tied idempotency
  • completion के लिए signed webhooks
  • assistant turns के लिए Chat API
  • जहां chat को live output चाहिए, वहां server-side event stream
  • failed jobs के लिए admin या support views

हर addition real product need answer करे। अगर वह सिर्फ demo को बड़ा दिखाता है, तो उसे छोड़ दें।

Common integration mistakes

इन patterns से बचें:

  • हर API feature से एक साथ start करना
  • account owner से credit usage hide करना
  • API flow में Studio-only assumptions use करना
  • file uploads को afterthought की तरह treat करना
  • idempotency के बिना generation requests retry करना
  • Chat API को उन jobs के लिए use करना जिन्हें async generation होना चाहिए
  • chat turns के लिए generation endpoints use करना
  • full API keys, webhook secrets या temporary file details log करना

Safest API workflow ownership, state और failure handling के बारे में explicit होता है।

आगे कहां जाएं

  • Public API hub के लिए Developers से start करें।
  • First request run करने के लिए Rivya API Quickstart use करें।
  • Model IDs select करने से पहले API Models use करें।
  • Files API तभी use करें जब model को सच में reference media चाहिए।
  • Chat turns और streaming chat responses के लिए Chat API use करें।
  • Polling enough न रहे तो API Webhooks use करें।
  • अगर workflow को अभी भी human exploration चाहिए, automate करने से पहले When to Use Rivya API Instead of Studio पढ़ें।

Explore जारी रखें

और पोस्ट

Rivya team से related guides, product notes और workflow breakdowns पढ़ना जारी रखें।

Loop में रहें

अगला workflow, model note या product update सीधे अपने inbox में पाएं

क्रिएटर्स के लिए concise newsletter, जो practical ideas, sharper taste और कम throwaway updates चाहते हैं।

New model launches और feature dropsछोटे workflow ideas जिन्हें आप जल्दी apply कर सकते हैं

Spam नहीं। कभी भी unsubscribe करें।