Skip to main content
When a Fhddos API call fails, the platform returns a structured error object with a consistent shape across all API interfaces. The exact outer envelope may vary depending on the protocol style you’re using — OpenAI-compatible or Anthropic-compatible — but the core fields and their semantics are the same everywhere.

Error Response Structure

Every error response body follows this format:
{
  "error": {
    "code": "invalid_request_error",
    "message": "Invalid image size. The longest edge must be <= 4096. (request id: 20260604120000abcdef)",
    "type": "invalid_request_error",
    "request_id": "20260604120000abcdef",
    "upstream_request_id": "req_abc123"
  }
}
FieldDescription
error.codeMachine-readable error code. Upstream business errors preserve upstream semantics.
error.messageHuman-readable message that is safe to display to users or write to logs.
error.typeBroad error category. Upstream business errors preserve upstream semantics.
error.request_idPlatform request ID — include this in every support ticket.
error.upstream_request_idUpstream provider’s request ID, if the provider returned one.

HTTP Status Codes

Fhddos assigns stable semantic meaning to each HTTP status code so your error-handling logic stays predictable regardless of which upstream provider handled the request:
CodePlatform meaningUpstream behavior
400Invalid request parameters, unsupported model capability, or content input issueUpstream 400 and readable message preserved
401Invalid or missing Fhddos API keyUpstream account or key errors are never surfaced as a client-side 401
402Account, token, or organization quota exhaustedUpstream balance, billing, and quota issues are wrapped as 503
403No access to model, group, IP allowlist, or resourceUpstream permission and account-ban errors are wrapped as 503
429Fhddos or upstream rate limit triggeredUpstream 429 is preserved with rate-limit semantics; sensitive details are removed
502Upstream returned an invalid or bad response, or gateway errorPreserved or sanitized
503Upstream channel account, permission, balance, or capacity temporarily unavailableWrapped operational supply error
504Upstream timeout or network connection issuePreserved or sanitized

Platform-Wrapped Errors

The following errors are always wrapped by Fhddos so you can handle them reliably without being exposed to upstream operational details:
error.typeerror.codeMeaningRecommended action
system_errorupstream_channel_unavailableUpstream channel account, key, or permission is temporarily unavailableRetry later; open a ticket if the error persists
system_errorupstream_capacity_unavailableUpstream balance, billing, quota, or capacity is temporarily unavailableRetry later; open a ticket if the error persists

Content Safety and Image Blocking

When an upstream provider explicitly blocks a request due to content safety or image filtering, Fhddos preserves the user-understandable reason — for example, “image filtered by safety policy” — without exposing the provider’s internal fields.
Upstream internal signalWhat you see
finishReason=IMAGE_SAFETYInternal field removed; “image filtered by safety policy” semantic preserved
finishReason=PROHIBITED_CONTENTInternal field removed; content safety semantic preserved
promptFeedback.blockReason=PROHIBITED_CONTENTInternal field removed; input content safety semantic preserved
no candidates / empty_candidatesImplementation detail removed; upstream readable reason or platform safe message preserved
Do not retry content safety or image blocking errors directly. Modify your prompt, text, or image first, then resubmit the request.

The no_image_generated Error

Gemini image models may process a request and bill for tokens without actually producing an image. In this case, Fhddos returns error.code=no_image_generated. If the request was already billed, the error response includes a usage field so you can reconcile charges:
Interface styleUsage fields
OpenAI-style synchronous image endpointusage.input_tokens, usage.output_tokens, usage.total_tokens
Gemini native generateContentusageMetadata.promptTokenCount, usageMetadata.totalTokenCount
Async image task queryusage.prompt_tokens, usage.input_tokens, usage.output_tokens
If the failure produced no billable usage — for example, local parameter validation failure, insufficient quota, network failure, or upstream returned no usage — the usage field is omitted.

Retry Guidance

ScenarioRecommendation
Content safety or image blockedDon’t retry — modify your input first
Invalid request params, unsupported model capability, context length, or image sizeDon’t retry — fix the request
Upstream rate limit (429)Retry with delay and reduced concurrency
Upstream timeout or network errorRetry; add a business-side timeout and idempotency handling for long-running tasks
Upstream 5xx or bad responseShort retry; file a support ticket if the issue persists
upstream_channel_unavailable or upstream_capacity_unavailableRetry later; file a support ticket if the issue persists

What Fhddos Sanitizes from Upstream Errors

Fhddos removes the following categories of information from upstream responses before they reach you:
  • Upstream API keys, account details, permissions, and balance or billing specifics
  • Upstream provider SDK information, exception stack traces, internal request IDs, and URLs
  • Internal channel, group, tenant, organization, and workspace names
  • Raw bad-response status codes, multi-level request ID chains, and unredacted upstream JSON
To investigate a specific failure, provide error.request_id in your support ticket. The Fhddos support team can use that ID to view the complete internal trace and the original upstream error.
In production, log error.request_id, the HTTP status code, error.code, and error.type for every failed request. Avoid branching your error-handling logic on error.message — message text can vary across upstream providers and may change over time.