Docs
API Reference

Error Codes

Stable Qufas HTTP and streaming error shapes, codes, and recovery actions.

Documented statuses

The stable Runtime/OpenAPI contract uses HTTP 400, 401, 402, 403, 404, 429, 500, 502, 503, and 504. HTTP 409 and 422 are not part of the current public contract.

Error response format

Depend on type, param, code, HTTP status, and the response request ID. Messages are human-readable and may evolve.

400 JSON
1{2  "error": {3    "message": "The parameter 'n' is not supported by this gateway.",4    "type": "invalid_request_error",5    "param": "n",6    "code": "unsupported_parameter"7  }8}

Documented machine-readable codes

This table covers stable public HTTP errors and the runtime SSE failures developers need to handle. It does not expose internal diagnostics, and it should not be interpreted as a promise that no additional machine-readable code can be introduced.

HTTPTypeCodeMeaningCommon causeRetryableDeveloper action
400invalid_request_errorinvalid_jsonThe body is not valid JSON.Malformed JSON.noFix JSON syntax and retry.
400invalid_request_errorinvalid_requestThe request object is invalid.Wrong top-level shape.noSend a JSON object matching the endpoint schema.
400invalid_request_errormissing_required_parameterA required field is missing.Missing model, messages, or prompt.noAdd the field named by error.param.
400invalid_request_errorinvalid_parameterA supported parameter has an invalid value.Wrong type, range, or message shape.noUse the documented constraint for error.param.
400invalid_request_errorunsupported_parameterThe parameter is not in the stable Qufas contract.An OpenAI option not supported by Qufas was sent.noRemove the field named by error.param.
400invalid_request_errorinvalid_modelThe model cannot serve this workload.Disabled model or wrong workload type.noChoose an eligible ID from GET /v1/models.
400invalid_request_errorinvalid_nThe requested image count is invalid.n is not an integer from 1 through 4.noSend n between 1 and 4.
400invalid_request_errorinvalid_sizeThe image size is invalid or unsupported.Wrong size format or model size.noUse a supported size for the selected image model.
400invalid_request_errorinvalid_cursorThe generation-list cursor is invalid or cannot be verified.Malformed, expired, or incompatible cursor.noRestart pagination without the cursor.
400invalid_request_errorinvalid_response_formatThe image response format value is invalid.response_format is not url or b64_json.noUse the supported public value url.
400invalid_request_errormodel_pricing_not_configuredThe selected model has no callable billing configuration.Model pricing metadata is incomplete.noChoose another callable model or contact support.
401authentication_errorinvalid_api_keyThe API key is missing, malformed, inactive, or invalid.Bearer authentication failed.noSend an active qf_sk_ key from server-side code.
401authentication_errorexpired_api_keyThe API key has expired.expires_at has passed.noCreate a replacement in the dashboard and revoke the old key.
402insufficient_balanceinsufficient_balanceThe prepaid balance cannot cover execution.Account balance is insufficient.noAdd credits, then retry the logical operation.
403permission_errormodel_not_allowedThe key cannot use this model.Model allowlist denied the request.noUse an allowed model or update the key in the dashboard.
403permission_errormonthly_spend_limit_exceededThe key reached its monthly spend limit.Configured key spend policy.noRaise the dashboard limit or wait for reset.
404invalid_request_errormodel_not_foundThe requested model is unavailable.Unknown or non-callable model ID.noRefresh GET /v1/models and choose a returned ID.
404invalid_request_errorgeneration_not_foundThe requested Generation is not visible to this API key.Unknown request ID or a Generation owned by another API key.noCheck the request ID and use the same API key that created the Generation.
404invalid_request_errornot_foundThe public route does not exist.Wrong path or method.noCheck the stable API reference.
429rate_limit_errorrate_limit_exceededThe key exceeded requests per minute.Traffic exceeded the configured key limit.yesHonor Retry-After and retry with backoff.
429rate_limit_errorprovider_rate_limitThe upstream Provider rate-limited the request.Normalized upstream HTTP 429.yesHonor retry guidance and use bounded backoff.
500internal_errorserver_not_configuredThe gateway cannot initialize required server configuration.Temporary service configuration failure.conditionalRetry later or contact support with the request ID.
500internal_errorbalance_lookup_failedBalance verification could not complete.Transient internal storage failure.conditionalRetry later and retain the request ID.
500internal_errormonthly_spend_lookup_failedMonthly key spend could not be verified.Transient usage storage failure.conditionalRetry later and retain the request ID.
500internal_errormodel_pricing_lookup_failedBilling metadata could not be resolved.Transient pricing lookup failure.conditionalRetry later or contact support.
500billing_errorbilling_consistency_errorA successful result could not be billed consistently.A billing consistency invariant failed.conditionalDo not assume success; contact support with the request ID.
500internal_errormodel_list_failedCallable models could not be listed.Transient model registry read failure.conditionalRetry later.
500internal_errorusage_lookup_failedUsage records could not be listed.Transient usage storage failure.conditionalRetry later.
500internal_errorusage_cost_lookup_failedUsage cost rows could not be loaded.Transient billing storage failure.conditionalRetry later.
500internal_errorapi_keys_lookup_failedAPI key metadata could not be listed.Transient API key storage failure.conditionalRetry later.
500internal_errorgeneration_lookup_failedGeneration metadata could not be loaded.Transient Generation storage failure.conditionalRetry later and retain the request ID.
500internal_errorprovider_attempt_create_failedQufas could not initialize an upstream attempt record.Transient internal request-initialization failure.conditionalRetry selectively and retain the request ID.
500internal_errorconfiguration_errorThe selected model has an invalid service-side provider mapping.Service configuration does not currently permit execution.noDo not change a valid request; contact support with the request ID.
502provider_errorprovider_authentication_errorQufas could not authenticate to the upstream Provider.Normalized upstream HTTP 401 or 403.noContact support with the Qufas request ID.
502provider_errorprovider_bad_requestThe upstream Provider rejected Qufas's normalized request.Normalized upstream 4xx other than timeout or rate limit.noRetain the request ID and contact support if the documented request is valid.
502provider_errorprovider_unavailableThe Provider is temporarily unavailable.Normalized upstream availability or 5xx failure.yesRetry with backoff using the same logical idempotency key.
502provider_errorprovider_unknown_errorThe upstream request failed without a more specific normalized result.Unknown transport or Provider failure.conditionalRetry selectively and retain the request ID.
502provider_errorprovider_errorAn image Provider request failed before a normalized result was available.Generic image Provider transport failure.conditionalRetry selectively and retain the request ID.
502provider_errorprovider_stream_errorThe upstream stream could not be opened.Provider stream setup failed before response headers.conditionalRetry selectively and retain the request ID.
503provider_errorprovider_not_configuredThe selected provider adapter is not configured.Provider configuration is unavailable.noContact Qufas support with the request ID.
503provider_errorall_providers_unavailableEvery configured candidate is unavailable.Circuit filtering or provider availability.yesRetry later; Qufas will not call an OPEN provider.
504provider_errorprovider_timeoutThe upstream provider timed out.Provider execution exceeded its timeout.yesRetry selectively with backoff.
SSEprovider_errorprovider_timeoutThe upstream Provider timed out after streaming headers.Streaming execution exceeded its timeout.yesTreat the stream as failed, retain the request ID, and retry selectively.
SSEprovider_errorprovider_stream_errorThe upstream stream failed after headers.Provider, malformed chunk, or incomplete upstream stream.conditionalTreat the stream as failed and retain the request ID.
SSEprovider_errorempty_provider_streamThe provider stream opened but produced no usable event.Empty or prematurely closed upstream stream.conditionalTreat the stream as failed and retry selectively with backoff.
SSEprovider_errorrepeated_streaming_chunk_limitQufas stopped a stream that repeated the same chunk beyond its safety limit.Abnormal repetitive upstream output.conditionalTreat the stream as failed; retry selectively or change the request.
SSEprovider_errormalformed_stream_chunkThe provider emitted a chunk that could not be parsed.Malformed upstream SSE payload.conditionalTreat the stream as failed and retry selectively with backoff.
SSEbilling_errorusage_missingThe stream ended without usage required to finalize billing.The provider omitted its terminal usage payload.conditionalTreat the logical operation as failed and retain the request ID before retrying.
SSEinternal_errorstreaming_errorThe streaming response could not be completed.Unexpected stream-processing failure.conditionalTreat the stream as failed and retry conditionally with the request ID retained.
SSEinsufficient_balanceinsufficient_balanceStreaming accounting detected insufficient balance after headers were sent.The prepaid balance could not cover finalization.noAdd credits before retrying the logical operation.
SSEbilling_errorbilling_temporarily_unavailableStreaming billing finalization is temporarily unavailable.Transient billing storage failure after headers.conditionalTreat the logical stream as failed and contact support before blind retry.
SSEbilling_errorbilling_consistency_errorStreaming billing could not be finalized consistently.A billing consistency invariant failed.conditionalDo not assume success; contact support with the request ID.

Showing 52 of 52 documented public codes.

Provider errors are normalized

Qufas normalizes, redacts, and maps upstream provider failures. Do not parse provider raw messages or depend on provider-specific diagnostics. Use the Qufas status, error code, and x-qufas-request-id.

Retry guidance

Retry 429, 502, 503, and 504 selectively with bounded exponential backoff. Do not retry authentication, permission, validation, or unsupported-parameter errors without changing the request. Streaming in-band errors mean the logical operation did not complete normally.

An SSE error can be followed by [DONE]; the marker ends the stream and does not make the error a success. Client Stop/disconnect is distinct from a provider error and does not guarantee provider cancellation or zero cost. Missing usage can leave settlement incomplete, while a billing/reporting error can occur after a charge commits. Check usage and billing with the request ID before retrying; preserve the same idempotency key for the same logical operation.

Was this page helpful?