Login
Guides

Errors & Rate Limits

HTTP status codes, error payloads, and throttling.

All documentation

Understand failure modes so you can retry safely and surface clear messages to users.

Error envelope

{
  "success": false,
  "error": "Error message",
  "details": {
    "tokensRequired": 120,
    "remainingTokens": 40
  }
}

details is optional and varies by error type.

HTTP status codes

StatusMeaningTypical cause
200SuccessRequest completed
400Bad RequestMissing prompt/model/input, unsupported type, stream not allowed
401UnauthorizedMissing, invalid, or expired API key
402Payment RequiredNo active subscription/credit or insufficient tokens
403ForbiddenProvider/model not allowed for this key
413Payload Too LargePrompt/messages exceed platform limits
429Too Many RequestsHourly rate limit or IP throttle exceeded
500Server ErrorUnexpected failure during generation
503UnavailablePricing/config temporarily unavailable

Common error messages

Missing API key

{
  "success": false,
  "error": "API key is required. Please provide it in X-API-Key header or Authorization header."
}

Invalid API key format

{
  "success": false,
  "error": "Invalid API key format",
  "details": {
    "isExpired": false,
    "isProviderAllowed": true,
    "isModelAllowed": true,
    "isRateLimited": false
  }
}

Invalid parameters

{
  "success": false,
  "error": "Prompt is required and must be a string"
}
{
  "success": false,
  "error": "Model is required and must be a string"
}
{
  "success": false,
  "error": "Model not found or unavailable"
}
{
  "success": false,
  "error": "Field \"input\" is required for embedding requests (string or array of strings)"
}

Insufficient tokens

{
  "success": false,
  "error": "Insufficient tokens for this operation",
  "details": {
    "tokensRequired": 500,
    "remainingTokens": 120
  }
}

No subscription / credit

{
  "success": false,
  "error": "No active subscription found. Please purchase a subscription to use this service."
}

Rate limited key

{
  "success": false,
  "error": "Rate limit exceeded",
  "details": {
    "isRateLimited": true,
    "remainingHourlyRequests": 0
  }
}

Rate limits

Each API key can define rate_limit_per_hour and max_tokens_per_request.

Inspect live values via GET https://ai.lumowp.com/api/external/ai:

FieldDescription
api_key_info.rate_limit_per_hourMax requests per hour
api_key_info.remaining_hourly_requestsRemaining requests in the current window
api_key_info.max_tokens_per_requestMax completion (reply) tokens per text call
limits.*Platform prompt/message/embedding caps

There is also a shared per-IP throttle on the External API.

Retry guidance

StatusRetry?Strategy
429YesExponential backoff; respect hourly window
500 / 503YesRetry with jitter; fail after a few attempts
400 / 401 / 403NoFix request or key configuration
402NoTop up credits/tokens or renew subscription
413NoShorten prompt/messages/input

Client-side pattern

async function callExternalAI(body, apiKey) {
  const res = await fetch("https://ai.lumowp.com/api/external/ai", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-Key": apiKey
    },
    body: JSON.stringify(body)
  })

  const json = await res.json()

  if (!res.ok || !json.success) {
    const error = new Error(json.error || "Request failed")
    error.status = res.status
    error.details = json.details
    throw error
  }

  return json.data
}