Fix "Upstream request failed" (502 upstream_error)
What the 502 upstream_error "Upstream request failed" means on BigModel.io, when to retry, how to read errors passed through from the model service, and what to send support.
You called a model and got this back, either as the response body or as an error event in the middle of a stream:
{ "error": { "type": "upstream_error", "message": "Upstream request failed" } }#What it means
BigModel.io accepted your request, checked the key and balance, and forwarded it to the model service. The service did not return a usable answer: the connection failed, timed out or returned an empty response. The request is not charged.
Some clients print it with extra text after the prefix, such as upstream request failed: empty response. The part after the colon is the reason the gateway saw.
#How to fix it
- Retry with backoff. A 502 is temporary. Wait 1–2 seconds, then double the wait on each retry, up to about 30 seconds. The OpenAI and Anthropic SDKs already retry 5xx twice by default (
max_retries/maxRetries). - Check the model's status. If the same model keeps failing for several minutes, try another model with the same endpoint from the model catalog.
- Shorten very long requests. Requests with huge inputs or very long outputs are more likely to time out. Stream the response so the connection stays active.
- Contact support if it persists. Send the
X-Request-ID, the time with timezone and the model ID to Support.
#Messages from other services
Errors that start with "upstream request failed" are also printed by other gateways and coding tools, with their own reasons after the colon. A message that asks you to change a workspace's privacy or training settings, for example, comes from the service or tool you were calling, not from BigModel.io. BigModel.io has no such setting and never uses prompts for training. To call the same models through BigModel.io instead, see the quickstart.
#Troubleshooting
The stream stops with event: error after some text. The model service failed mid-answer. Treat the partial output as incomplete and retry the whole request. See Streaming.
Every request fails with 502, on every model. Check that your network or proxy is not cutting long-lived connections, then contact support with a request ID.
#Related
Updated · View as Markdown