Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.babysea.ai/llms.txt

Use this file to discover all available pages before exploring further.

BabySea returns structured BSE errors from application routes. Each error includes a stable code, a machine-readable type, a human-readable message, and a retryable boolean.

Error envelope

JSON
{
  "status": "error",
  "request_id": "req_...",
  "error": {
    "code": "BSE1005",
    "type": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Please retry after the period indicated in the Retry-After header.",
    "retryable": true,
    "details": {
      "retry_after_seconds": 17,
      "limit": 60
    }
  }
}
When multiple providers fail during failover, the error can include provider_errors with provider-level details.

Retry guidance

ConditionRetry?Notes
retryable: trueYesUse exponential backoff. The SDK retries these automatically.
HTTP 429YesRespect Retry-After.
HTTP 4xx except 429NoFix authentication, scope, input, or account state.
HTTP 5xx with retryable: trueYesUsually provider or transient infrastructure failure.
provider_credits_exhaustedNoChoose another model/provider or wait for provider capacity to return.
Use the retryable field, not only the HTTP status code. Some inference provider failures use 5xx but are not retryable.

Authentication and authorization

CodeTypeHTTPRetryableMeaning
BSE1001authentication_required401NoMissing API key.
BSE1002authentication_failed401NoInvalid or expired API key.
BSE1003insufficient_permissions403NoKey lacks the required scope.
BSE1004insufficient_credits402NoAccount balance cannot cover the request.
BSE1005rate_limit_exceeded429YesAccount request limit exceeded.
BSE1006auth_rate_limited429YesToo many authentication attempts from the same IP.
BSE1007ip_not_allowed403NoClient IP is not in the key allowlist.
BSE1008account_not_found404NoThe account linked to the key was not found.
BSE1009concurrency_limit_exceeded429YesToo many concurrent generations in flight for this account.

Input validation

CodeTypeHTTPRetryableMeaning
BSE2001invalid_input400NoRequest body has invalid parameters.
BSE2002file_too_large422NoFile dimensions exceed model limits.
BSE2003file_too_small422NoFile dimensions are below model minimums.
BSE2004unsupported_file_format422NoFile type is unsupported.
BSE2005file_load_error422NoFile could not be loaded or processed.
BSE2006content_policy_violation422NoInput was rejected by safety filters.
BSE2007file_size_exceeded422NoFile exceeds byte-size limits.
BSE2008parameter_out_of_range422NoParameter value is outside the allowed range.
BSE2009file_download_error422NoBabySea could not download a file URL.
BSE2010request_body_too_large413NoRequest body exceeds the maximum allowed size.
BSE2011generation_not_found404NoGeneration does not exist or belongs to another account.
BSE2012generation_not_cancelable409NoGeneration already completed, failed, or was canceled.
BSE2013generation_cancel_window_expired409NoGenerations can only be canceled within 12 seconds of creation.
BSE2014unsafe_file_url422NoURL targets private, reserved, or non-HTTPS infrastructure.
BSE2015idempotency_key_conflict409NoIdempotency-Key was reused with a different request body.
BSE2016idempotency_request_in_progress409YesRequest with this Idempotency-Key is still being processed.
BSE2017endpoint_not_found404NoThe requested endpoint does not exist.

Model and configuration

CodeTypeHTTPRetryableMeaning
BSE3001model_not_found404NoUnknown model identifier.
BSE3002model_not_configured500NoModel exists but configuration is incomplete.
BSE3003feature_not_supported422NoField or combination is not supported by the model.
BSE3004model_type_mismatch422NoModel type does not match the image or video route.

Inference provider errors

CodeTypeHTTPRetryableMeaning
BSE4001provider_timeout504YesInference provider did not respond in time.
BSE4002provider_out_of_memory502YesInference provider ran out of memory.
BSE4003all_providers_failed502YesEvery inference provider in the chain failed.
BSE4004provider_internal_error502YesInference provider returned an internal error.
BSE4005provider_unavailable503YesInference provider is temporarily unavailable.
BSE4006prediction_canceled409NoInference provider prediction was canceled.
BSE4007provider_health_check_failed502YesInference provider failed health checks.
BSE4008provider_start_error502YesInference provider failed to start the prediction.
BSE4009provider_upload_failed502YesUpload to inference provider failed.
BSE4010provider_credits_exhausted502NoInference provider capacity is exhausted.

Internal errors

CodeTypeHTTPRetryableMeaning
BSE5001internal_server_error500NoUnexpected server error.
BSE5002database_error500NoDatabase read or write failed.
BSE5003storage_error500NoFile storage read or write failed.

Rate-limit headers

Rate-limited routes include these headers:
HeaderDescription
X-RateLimit-LimitMaximum requests in the current 60-second window.
X-RateLimit-RemainingRemaining requests in the current window.
X-RateLimit-ResetUnix timestamp when the window resets.
Retry-AfterPresent on 429; seconds to wait before retrying.

Malformed requests

Malformed requests can be rejected before BabySea returns a structured BSE envelope. Validate the method, path, body shape, and headers before retrying.