Deep Seek Exception
Base class for all exceptions thrown by DeepSeek SDK endpoint calls.
Thrown by every endpoint extension function (chat, FIM, models, userBalance, and their streaming counterparts) when the API returns a non-2xx status. Use statusCode and the subclass type to distinguish failure modes, error to inspect the structured error payload, and headers for rate-limit or retry hints.
Example:
try {
client.chat("hello")
} catch (e: DeepSeekException.RateLimitException) {
val retryAfter = e.headers["Retry-After"]
// back off and retry
} catch (e: DeepSeekException) {
println("DeepSeek call failed with ${e.statusCode}: ${e.message}")
}Inheritors
Types
Thrown for HTTP 400 — the request body or parameters are malformed.
Thrown for HTTP 402 — the account has insufficient balance to complete the call.
Thrown for HTTP 500 — the DeepSeek service failed to process the request.
Thrown for HTTP 404 — the endpoint or model referenced by the request does not exist.
Thrown for HTTP 503 — the DeepSeek service is temporarily overloaded.
Thrown for HTTP 403 — the API key is valid but lacks permission for the resource.
Thrown for HTTP 429 — the client exceeded the allowed request rate.
Thrown for HTTP 401 — the API key is missing, invalid, or revoked.
Thrown for any non-2xx status not covered by the other subclasses.
Thrown for HTTP 422 — the request is syntactically valid but semantically invalid (for example, a parameter is outside its allowed range).