APIrove

Docs / 502, 504, timeouts and interrupted streams: when to retry

APIrove · INTEGRATION NOTES

502, 504, timeouts and interrupted streams: when to retry

Separate HTTP failures, local deadlines and partial output before deciding whether another request is safe.

Not live-tested: this guide was checked against documentation on November 19, 2026. No APIrove or model API requests were made. Client versions, enabled models and limits need separate verification.

Identify where the request stopped

ObservationWhat it establishesNext step
HTTP 502An HTTP layer could not finish successfullyKeep a sanitized failure summary; do not assume work never started.
HTTP 504An HTTP layer exceeded its wait deadlineCheck usage and application state before replaying.
Local timeout / no HTTP statusThe client stopped waitingCheck connectivity and client timeout settings; completion is unknown.
HTTP 200 followed by a broken streamSome output may already have been consumedMark the result incomplete; do not append a replay to it.

A bounded non-streaming diagnostic

For a model confirmed to support Chat Completions, replace YOUR_ENABLED_MODEL_ID and set the key securely in your shell. This example would make a real generation request if you run it. There is no automatic retry; the connection and total deadlines below are illustrative client choices, not APIrove service guarantees.

cURL · non-streaming · finite deadline
# APIROVE_API_KEY must already be set securely in your shell.
curl --silent --show-error --connect-timeout 10 --max-time 45 \
  https://apirove.com/v1/chat/completions \
  -H "Authorization: Bearer ${APIROVE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_ENABLED_MODEL_ID","messages":[{"role":"user","content":"Reply OK"}],"stream":false}'

Compare this with the same model's streaming request only after the basic request works. The SDK Base URL remains:

Base URL
https://apirove.com/v1

Streaming has more than one timeout

Check the application's network path for buffering or idle disconnects. A TCP chunk is not necessarily one SSE event: buffer through the event separator and parse the selected protocol. Chat Completions uses data: [DONE] as its terminal marker; Responses uses named events such as response.completed, response.failed or response.incomplete. Do not apply one protocol's completion rule to the other. A closed socket or HTTP 200 alone is not completion.

Retry only after checking the result

  1. If the result is unknown, inspect application state and usage first. A timeout does not prove cancellation, no processing or no charge.
  2. For a confirmed transient failure before output, and only when replay is safe, use a small bounded retry budget with backoff. Follow Retry-After if present; schedule later if it exceeds your deadline.
  3. If any text or tool call was consumed, stop automatic replay. Preserve the partial result separately and let the user start a new attempt.
  4. Tool actions need their own deduplication. Do not assume a generic idempotency header, resumable stream or refund behavior is supported.

Persisting failures: check the status page and contact support privately with time, time zone, endpoint, model and a sanitized summary. For throttling use 429 recovery; authentication belongs in 401 / 403 / 404.

Sources: OpenAI recovery guidance and Responses streaming documentation. APIrove capabilities still require separate verification.

Related guides

Request troubleshooting overview · Endpoint and request formats · Model directory · Key security

FAQ

Does a timeout mean the request was not processed?

No. The client deadline can expire while work continues. Check application state and usage before sending another request.

Can I retry after receiving some streamed output?

Do not automatically replay or append a second result. Keep the partial output separate and request a new attempt explicitly.

Does streaming guarantee a faster final result?

No. Streaming changes delivery; it does not guarantee a shorter total generation time or uninterrupted output.

New to APIrove? Register, check the available top-up options, then create a key. Existing users can follow the checks above.

Get started with APIrove
One API for text, image and video output