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
| Code | HTTP status | Meaning | Suggested action |
|---|---|---|---|
public_api_disabled | 503 | Public API calls temporarily disabled हैं। | बाद में retry करें या Studio manually इस्तेमाल करें। |
api_key_missing | 401 | Request में Bearer API key शामिल नहीं थी। | Authorization: Bearer rvya_sk_... भेजें। |
api_key_invalid | 401 | Key verify नहीं हो सकती। | Key check करें और जरूरत हो तो rotate करें। |
api_key_revoked | 401 | Key Settings में revoke की गई थी। | नई key create करें। |
api_key_expired | 401 | Key अब valid नहीं है। | नई key create करें। |
api_scope_denied | 403 | Key के पास required scope नहीं है। | Needed scope वाली key create करें। |
rate_limited | 429 | Current window में बहुत अधिक requests हैं। | Back off करें और बाद में retry करें। |
validation_failed | 400 | Body, model, prompt या params invalid हैं। | अपने body को model reference से compare करें। |
not_found | 404 | Requested task मौजूद नहीं है या account की owned नहीं है। | Public task ID और account boundary check करें। |
webhook_url_rejected | 400 | Webhook endpoint URL allowed नहीं है। | Credentials, fragments, localhost या private network addresses के बिना HTTPS public URL इस्तेमाल करें। |
chat_model_not_supported | 400 | Selected model Chat API के लिए available नहीं है। | /api/v1/models read करें और available chat model चुनें। |
chat_session_conflict | 409 | Chat session इस request के लिए इस्तेमाल नहीं हो सकता। | Same account और model की API-created session इस्तेमाल करें। |
chat_attachment_not_supported | 400 | Chat attachment supported नहीं है। | Files API से image upload करें और उसका file_id pass करें। |
idempotency_conflict | 409 | Same idempotency key अलग input के साथ reuse हुई। | नई key इस्तेमाल करें या बिल्कुल वही body resend करें। |
insufficient_credits | 402 | Account के पास पर्याप्त credits नहीं हैं। | Credits add करें या lower-cost request चुनें। |
internal_error | 500 | Request 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_idstore करें - 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_disabledrate_limitedinternal_error- temporary network failures
Input बदले बिना इन्हें retry न करें:
api_key_invalidapi_key_revokedapi_scope_deniedvalidation_failedwebhook_url_rejectedchat_model_not_supportedchat_session_conflictchat_attachment_not_supportedidempotency_conflictinsufficient_credits
Related Pages
API Credits
समझें कि Rivya API calls account credits, balance checks, reserved credits, failed task refunds और credit troubleshooting कैसे इस्तेमाल करती हैं।
Files API
MIME checks, size limits और duration tokens के साथ Rivya API generation requests के लिए image, video या audio reference files upload करें।