錯誤與冪等
標準錯誤、重試、限流與防止重複提交。
錯誤使用 application/problem+json、真實 HTTP 狀態碼與 request_id。
建立請求必須使用 8–128 字元的 Idempotency-Key。伺服器僅儲存 Key 的 HMAC 與請求指紋:相同 Key/本文回傳原任務;相同 Key/不同本文回傳 409 idempotency_conflict;原請求仍在處理時回傳 409 request_in_progress。自動重試不可產生新 Key。
常見錯誤包括 invalid_api_key、invalid_api_key_rate_limited、api_key_expired、insufficient_scope、validation_error、unsupported_model、unsupported_parameter、input_url_not_allowed、insufficient_credits、payment_required、account_suspended、network_not_allowed、rate_limit_exceeded、concurrency_limit_exceeded、provider_unavailable 與 service_unavailable。
同一客戶端 IP 連續提交無效憑證也會被限流;系統只儲存經 Pepper HMAC 處理的 IP 指紋。
網路錯誤、429 與 503 可退避重試,但本文與冪等 Key 必須完全相同。Provider 結果無法確認時,API 會拒絕盲目重提。
重新嘗試前務必遵循 Retry-After header。