KhaBot

Errors

Every error uses one envelope:

{ "error": { "code": "quota_exhausted", "message": "Monthly quota exceeded", "details": {} } }

Code table

HTTPcodeWhen
400bad_key / invalid_requestMalformed request or document key (incl. ./..)
400already_subscribedYou already hold that subscription
401unauthenticated / key_expiredMissing, bad, or expired API key
402quota_exhausted / key_budget_exhausted / insufficient_creditMoney / quota walls
403model_not_in_planNone of your plans include the requested model
403reserved_keyWrite/delete to a reserved kb-* document
403model_denied / model_not_priced / byok_not_enabled / forbiddenPolicy walls
403document_too_large / document_limit_reachedDocument exceeds the char cap / per-account document cap
403service_not_coveredNo active plan includes this service and extra credits can't cover it
403model_not_allowed_for_keyThe model is outside this API key's model list
403service_not_allowed_for_keyThe service is outside this API key's service list
403document_key_not_allowedThe document key is outside this API key's document filter
403key_not_authorizedAn account-management endpoint was called with a key that doesn't carry that permission
404model_not_foundUnknown KhaBot model key
404document_not_foundGET/DELETE a document that doesn't exist (not billed)
404page_not_foundHTML to Markdown: the page no longer exists
422cost_limit / page_blocked / page_thin / page_unsupportedHTML to Markdown page-level refusals — see HTML to Markdown
429rate_limitedRPM exceeded (retry-after header)
502all_providers_failedThe request could not be completed upstream — retry
503upstream_unavailableA required service is temporarily unavailable
503page_fetch_failedHTML to Markdown: the page could not be retrieved — safe to retry
503service_not_configuredThe service isn't switched on

Always branch on error.code, not the human-readable message.