DINGJIAI
DINGJIAI
Quick start in 5 minutesWhat is DINGJIAI?

Online use

Online chatOpens in a new windowImage generationOpens in a new window

Popular Agents

Codex SetupClaude Code SetupOne-Click Setup

API Reference

API overview
Error codes

Billing

Model pricingTroubleshooting calls

Error codes

Error structures and codes returned when an API call fails.

Check the protocol format first

OpenAI- and Anthropic-style errors expose a string in error.code. Gemini-style errors use a numeric HTTP status in error.code; when troubleshooting, also check error.status, error.message, and X-Request-Id.

Error formats

Chat Completions, Responses, Codex Search, Images Generations, and OpenAI model lists use OpenAI-style errors.

{
  "error": {
    "message": "Insufficient balance. Recharge and try again.",
    "type": "billing_error",
    "code": "insufficient_balance",
    "request_id": "req_..."
  },
  "request_id": "req_..."
}

Anthropic Messages, Count Tokens, and the Anthropic model list use Anthropic-style errors.

{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "missing API key",
    "code": "api_key_missing"
  }
}

Gemini GenerateContent, streamGenerateContent, and the Gemini model list use Google-style errors.

{
  "error": {
    "code": 400,
    "message": "api_key_conflict",
    "status": "INVALID_ARGUMENT"
  },
  "request_id": "req_..."
}

Common gateway errors

The table below lists string error codes used by the gateway and in OpenAI- or Anthropic-compatible responses. Gemini responses do not put these values in error.code.

String error codeHTTPStageMeaning
api_key_missing401AuthenticationThe user API key was not provided in the protocol's required location.
api_key_invalid401AuthenticationThe user API key does not exist or is invalid.
api_key_disabled403AuthenticationThe user API key is disabled.
api_key_conflict400AuthenticationMultiple user-key headers were sent with different values.
unsupported_header400Request headerA header is unsupported or malformed, such as multiple Idempotency-Key values or an invalid anthropic-version.
unsupported_parameter400Request bodyA non-empty previous_response_id is not currently supported; send the complete Responses context instead.
insufficient_balance402BalanceThe user's balance is insufficient to start a model call.
user_not_found404BalanceThe account state is abnormal; contact the administrator.
request_body_too_large413Request bodyThe request body exceeds the gateway limit.
invalid_request_body400Request bodyThe JSON or request structure is invalid.
model_required400Request bodyThe required model name is missing.
model_not_found404DispatchThe model does not exist or is unavailable for the current entry.
stream_not_supported400Request bodyThe current path does not support stream=true in the request body.
gateway_concurrency_exceeded429ConcurrencyThe gateway's global concurrency limit has been reached.
user_concurrency_exceeded429ConcurrencyThe current user's concurrency limit has been reached.
upstream_not_configured502UpstreamNo eligible upstream candidate is configured.
upstream_cooling_down503UpstreamThe upstream is in a cooldown period.
upstream_concurrency_exceeded429UpstreamAll available upstream accounts are currently at their concurrency limit.
upstream_unavailable502UpstreamMultiple upstream candidates failed and the service is still unavailable.
upstream_network_error502UpstreamThe connection to the upstream failed.
upstream_auth_failed502UpstreamUpstream authentication failed.
upstream_access_denied502UpstreamThe upstream denied access.
upstream_quota_exceeded429UpstreamThe upstream account hit a quota or billing limit; it may recover through cooldown and follows 429 retry semantics.
upstream_rate_limited429UpstreamThe upstream returned a rate-limit response.
upstream_timeout504UpstreamThe upstream request timed out.
upstream_server_error502UpstreamThe upstream returned a 5xx service error.
upstream_model_unavailable502UpstreamThe upstream reported that the model is unavailable.
upstream_invalid_request400UpstreamThe upstream rejected the request parameters.
upstream_bad_status502UpstreamThe upstream returned an unmapped non-2xx status.
upstream_bad_response502UpstreamThe upstream response could not be processed according to the protocol.
upstream_stream_read_failed502UpstreamThe upstream streaming response was interrupted.
client_aborted499ClientThe client disconnected.
usage_missing502SettlementThe upstream response has no usage and does not meet the safety conditions for estimation.
usage_invalid502SettlementThe usage fields are malformed and the response cannot safely use a conservative estimate.
billing_calculation_failed500SettlementThe gateway failed to calculate billing.
duplicate_request409Pre-check / settlementThe request is being processed or has already been processed, including a matching Idempotency-Key.
billing_settle_failed500SettlementThe gateway failed to settle billing.
response_too_large502ResponseThe upstream response body exceeds the gateway limit.
internal_error500InternalAn internal gateway error occurred.

Handling errors by stage

Last updated on

request_id and troubleshootingModel pricing

On this page

Error formatsCommon gateway errorsHandling errors by stage