# What does 504 upstream_stalled or upstream_timeout mean?

The inference host stopped sending: upstream_timeout means it did not start answering within 180 seconds, upstream_stalled means it sent nothing for 60 seconds. Unlid cuts the request instead of letting it hang. A request that failed before any output is not charged; retry, or use another model if one keeps stalling.

## What it looks like

```
HTTP 504
{"error":{"message":"Upstream sent nothing for 60 s. You were not charged.","code":"upstream_stalled", …}}
```

## What to do

- Retry. Send an `Idempotency-Key` header so a retry can never run twice.
- If the same model stalls repeatedly, it is slow or overloaded right now: the [status page](https://unlid.ai/status) shows each model's time to first token and success rate over the last 24 hours. Switch models for a while.
- Very long prompts take longer before the first token; trimming old messages helps on slow models.

## Was I charged?

Not when the timeout came before any output. If a streamed answer stalls halfway, you keep the part already received and are billed only for those tokens.

## Related questions

- [Why do I get ECONNRESET or "Connection reset by server" with the Unlid API?](https://unlid.ai/answers/econnreset-connection-reset.md?lang=ja)
- [What does upstream_billing_error ("the upstream provider refused the request for an account reason") mean?](https://unlid.ai/answers/upstream-billing-error.md?lang=ja)
- [Why do I get 400 upstream_rejected_request ("blocked by safety filters")?](https://unlid.ai/answers/upstream-rejected-request.md?lang=ja)

Something not covered? Ask in the support chat at the bottom right, or see the [FAQ](https://unlid.ai/faq.md?lang=ja) and the [API docs](https://unlid.ai/docs.md?lang=ja).
