Skip to Content
hackrouter

Errors

One error shape, a code to act on, and whether to retry.

Errors come back with a code your program can act on, and the request ID to quote when asking about it:

{
  "error": {
    "type": "billing_error",
    "code": "insufficient_balance",
    "message": "…",
    "param": null
  },
  "request_id": "0193…"
}

On /v1/messages, the body has Anthropic's shape: "type": "error" at the top and no param. Act on code, not on message.

CodeWhat to do
invalid_request, body_not_json 400Fix the request. The message says what is wrong.
rejected_by_model 400 / 422The model refused the request, or it asks for a feature that cannot be translated. Change the request or the model.
invalid_api_key 401Check the key; it may have been revoked.
insufficient_balance 402Top up.
key_limit_reached 402Raise the key's monthly limit, or wait for next month (UTC).
account_suspended 403Write to contact@hackrouter.ai.
country_not_supported 403hackrouter is not available in mainland China.
model_not_found 404Use an ID from Models that offers the API you called.
request_not_found 404The request has not been charged yet, or is not yours. Try again in a minute or two.
route_not_found 404Check the path.
method_not_allowed 405Use a method from the allow header.
body_too_large 413The body is over 20 MiB. Send media by URL; see Files.
rate_limited 429Wait for retry-after seconds. See Rate limits.
internal_error 500Retry.
model_unavailable 503Every route for the model failed. Retry, or try another model.
storage_unavailable 503Retry later.

None of these are charged. A stream that breaks after it started ends with an error event whose code is stream_broken; what was sent is charged. See Streaming.

Every response carries an x-request-id header with the same ID.