Rivya AI दस्तावेज़

API Errors and Limits

Rivya API public error codes, HTTP status values, rate limits, idempotency conflicts और retry decisions handle करें।

अंतिम समीक्षा 2026/05/11 को

Rivya API JSON में stable public error codes return करता है। Integration contract के रूप में error.code value treat करें।

Error Shape

{
  "error": {
    "code": "api_key_missing",
    "message": "A valid Bearer API key is required.",
    "requestId": "req_..."
  }
}

जब failed API request की जांच के लिए Rivya support से बात करें, तो अपने logs में requestId रखें।

Stable Error Codes

CodeHTTP statusMeaningSuggested action
public_api_disabled503Public API calls temporarily disabled हैं।बाद में retry करें या Studio manually इस्तेमाल करें।
api_key_missing401Request में Bearer API key शामिल नहीं थी।Authorization: Bearer rvya_sk_... भेजें।
api_key_invalid401Key verify नहीं हो सकती।Key check करें और जरूरत हो तो rotate करें।
api_key_revoked401Key Settings में revoke की गई थी।नई key create करें।
api_key_expired401Key अब valid नहीं है।नई key create करें।
api_scope_denied403Key के पास required scope नहीं है।Needed scope वाली key create करें।
rate_limited429Current window में बहुत अधिक requests हैं।Back off करें और बाद में retry करें।
validation_failed400Body, model, prompt या params invalid हैं।अपने body को model reference से compare करें।
not_found404Requested task मौजूद नहीं है या account की owned नहीं है।Public task ID और account boundary check करें।
webhook_url_rejected400Webhook endpoint URL allowed नहीं है।Credentials, fragments, localhost या private network addresses के बिना HTTPS public URL इस्तेमाल करें।
chat_model_not_supported400Selected model Chat API के लिए available नहीं है।/api/v1/models read करें और available chat model चुनें।
chat_session_conflict409Chat session इस request के लिए इस्तेमाल नहीं हो सकता।Same account और model की API-created session इस्तेमाल करें।
chat_attachment_not_supported400Chat attachment supported नहीं है।Files API से image upload करें और उसका file_id pass करें।
idempotency_conflict409Same idempotency key अलग input के साथ reuse हुई।नई key इस्तेमाल करें या बिल्कुल वही body resend करें।
insufficient_credits402Account के पास पर्याप्त credits नहीं हैं।Credits add करें या lower-cost request चुनें।
internal_error500Request complete नहीं हो सकी।Idempotency के साथ retry करें या requestId के साथ support से contact करें।

Rate Limits

Rivya हर API key पर application-level Public API rate limits apply करता है। Default production limit PUBLIC_API_RATE_LIMIT_PER_MINUTE से configured है।

जब आपको rate_limited मिले, तो exponential backoff इस्तेमाल करें। Tight loop में retry न करें।

Idempotent Retries

हर production request के साथ Idempotency-Key भेजें: POST /api/v1/generations और POST /api/v1/chat/completions

Recommended pattern:

  • हर logical generation request के लिए unique key generate करें
  • same body retry करते समय ही same key reuse करें
  • returned public task ID को अपने job record के साथ store करें
  • Chat API के लिए, same conversation continue करनी हो तो returned session_id store करें
  • different model, prompt या params के लिए एक key reuse न करें

अगर submission के बाद network fail हो जाए, तो same body और same Idempotency-Key के साथ retry करें। Rivya duplicate task create करने के बजाय stored public response return कर सकता है।

Retry Decisions

इन पर backoff के साथ retry करें:

  • public_api_disabled
  • rate_limited
  • internal_error
  • temporary network failures

Input बदले बिना इन्हें retry न करें:

  • api_key_invalid
  • api_key_revoked
  • api_scope_denied
  • validation_failed
  • webhook_url_rejected
  • chat_model_not_supported
  • chat_session_conflict
  • chat_attachment_not_supported
  • idempotency_conflict
  • insufficient_credits

विषय-सूची