Errors & retries
Inspect the HTTP status, JSON error code and X-Request-ID. Never share Authorization headers or sensitive prompts when reporting a request.
Before streaming starts
{
"error": {
"type": "rate_limit_exceeded",
"code": "rate_limit_exceeded",
"message": "Capacity or API key limit reached"
}
}| Status | Meaning | Client action |
|---|---|---|
| 400 | Malformed or unsupported input | Correct the request; do not retry it unchanged. |
| 401 | Invalid or missing authentication | Check the DarkSeek key. A DeepSeek key is not valid here. |
| 403 | Disallowed browser origin | Use an allowed origin or your own server integration. |
| 404 / 405 | Unknown route / wrong HTTP method | Use an implemented endpoint and its documented method. |
| 413 / 415 | Oversized body / unsupported media type | Reduce the body; send uncompressed application/json. |
| 429 | Rate or concurrency limit | Wait at least Retry-After, then retry within a bounded budget with jitter. |
| 502 | Backend or protocol failure | A bounded retry may be appropriate. Generation may already have run. |
| 503 | Service or deployment binding unavailable | Check service readiness. Repeated retries do not configure a missing binding. |
| 504 | Inference deadline exceeded | Reduce output/request size and use a bounded retry policy. |
After streaming starts
HTTP status can no longer be replaced after the response has begun. Treat an event: error, network interruption or missing completion marker as failure, even if the original status was 200. Partial generated text is not a completed answer.
Cancellation and duplicate work
Cancel the HTTP request to stop consuming the stream. The Go gateway releases its admission slot and cancels its upstream request. Backend-side resource reclamation must also pass production load tests. Generation requests do not currently offer an idempotency contract: automatically resending a request can duplicate work.
Retry budget
Set a maximum attempt count and overall deadline. Retry only transient failures. Exponential backoff with jitter helps avoid synchronized retries; it is not a substitute for respecting capacity or fixing invalid credentials.