Skip to content
NotHolyDocs

Guides

Errors

Error format, status codes and which errors to retry.

View as Markdown

Errors use the format of the endpoint you called.

OpenAI formats:

JSON
{"error": {"message": "not enough credits for this request. Add credits in the console", "type": "insufficient_quota", "code": "insufficient_credits"}}

Messages:

JSON
{"type": "error", "error": {"type": "rate_limit_error", "message": "too many requests per minute for this key"}}
StatusCodeRetry?What to do
400invalid_request, unsupported_parameterNoFix the body
401invalid_api_keyNoCheck the key
402insufficient_credits, key_budget_exceededNoAdd credits or raise the key budget
403key_not_allowed, account_suspendedNoCheck the key's models or contact support
403consent_requiredNoThe key's creator refused or withdrew consent to processing in the United States and China. They can accept it in the console
404model_not_found, not_foundNoCheck the ID
413request_too_largeNoSend less
429rate_limit_exceeded, concurrency_limit_exceeded, capacity_busyYesWait for retry-after seconds
500internal_errorYes, with backoffReport the x-request-id if it repeats
502, 504upstream_error, upstream_timeoutYes, with backoff
503model_unavailableYesRetry with backoff (retry-after is set while the service restarts) or use another model

retry-after is in whole seconds, never more than 60. Failed requests are not charged.

Safe retries

For non-streaming requests, send an Idempotency-Key header. A retry with the same key within 24 hours returns the first response, with x-notholy-idempotent-replay: true, and is not charged again.

curl
curl https://api.notholy.com/v1/chat/completions \
  -H "Authorization: Bearer $NOTHOLY_API_KEY" \
  -H "Idempotency-Key: report-42-summary" \
  -H "Content-Type: application/json" \
  -d '{"model": "notholy-specter", "messages": [{"role": "user", "content": "One-line summary of an open redirect."}]}'

The official SDKs already retry 429 and 5xx with backoff.

Next