ナビゲーションにスキップ

A long text request disconnected. Must I generate it again?

A disconnected text call does not always require an immediate blind retry. First capture the client error, HTTP status, and any partial response text to distinguish a network timeout, an interrupted stream, and a gateway or model error.

Prevent timeouts on long text replies

  • Use the direct text endpoint: Send text requests to https://direct.beatapi.io/v1 rather than https://api.beatapi.io/v1. The direct endpoint avoids Cloudflare’s 100-second wait limit on long non-streaming responses while keeping the same API key, models, and prices.
  • Enable streaming: Set "stream": true on Chat Completions, Responses, or Messages so tokens arrive incrementally via server-sent events instead of waiting for one full payload.

Handle partial output and retries safely

  • Quarantine incomplete text: When only half of a summary or document arrives, flag the record as incomplete and block incomplete text from downstream publishing or final drafts.
  • Send a new text request when needed: Text endpoints never create asynchronous jobs, so GET /v1/tasks/{task_id} applies only to media, workflow, effect, or data task IDs, not text completions.
  • Retry selectively: Retry only 429, 500, and 503 failures with backoff; do not resend 400, 401, 402, 403, 404, or 413 requests unchanged.

Before sending a paid request, inspect the model contracts for free: model:gpt-6-luna, model:gpt-image-2.5-flare-std.

Back to AI Models questions.