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
404model_not_foundUnknown KhaBot model key
404document_not_foundGET/DELETE a document that doesn't exist (not billed)
429rate_limitedRPM exceeded (retry-after header)
502all_providers_failedThe request could not be completed upstream — retry
503upstream_unavailableA required service is temporarily unavailable

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