Skip to main content
All errors from the Hostlinku gateway use the same envelope format, regardless of the source: validation, authentication, billing, or an issue with the upstream service:
  • status: always "error" in a failed response.
  • error.code: machine code (stable, safe for use in conditional logic in your code).
  • error.message: human-readable message; can be in Indonesian.
  • error.details: optional; e.g., per-field details when validation fails.

List of Error Codes

Validation Details (422)

When validation fails, details.issues contains a list of issues by field:

Streaming Error

Errors that occur in the middle of an SSE stream are sent as data events in the same stream (not as HTTP status codes):
The gateway will not send data: [DONE] after an error event, so a disconnected stream can always be distinguished from a stream that completed normally.

Handling Errors in Code

How to handle each error category:
  • 401: Invalid or expired API key. Correct the configuration; do not retry repeatedly.
  • 402: Top up your balance or increase/reset your API key limit. See Billing & Balance.
  • 422: Fix the request body; see details.issues for the location of the problem.
  • 429: Exponential backoff and respect the rate limit header. See Usage & Limits.
  • 5xx (UPSTREAM_ERROR, PROVIDER_UNAVAILABLE, INTERNAL): retry with a backoff of several times; Hostlinku tried several times before giving up.
Example of handling errors with the OpenAI SDK (Python):