Standard error shape
All APIs use normal HTTP status codes for non-streaming failures, with error payloads that include a machine-readable type and a human-readable message. Typical JSON error:Common status codes
Streaming Errors
Streaming APIs can fail after the server has already sent200 OK. In that case, the error arrives inside the stream instead of as a normal JSON body.
Clients should parse frames structurally instead of blindly appending text.
Example mid-stream error payload:
Retry guidance
- do not blindly retry
400or401 - retry
429,500, and503with exponential backoff - keep retries bounded and log the final failure
Practical advice
- always branch on the machine-readable
error.type - log unknown error payloads before normalizing them away
- stop normal stream processing as soon as an error frame appears
- keep HTTP-level errors and late-stream errors in the same client error model when possible