B2BB2B LLM

Errors

HTTP error codes, response formats, and retry rules.

Errors

HTTPMeaningRecommended action
400Invalid requestCorrect JSON and required fields
401Invalid, frozen, or revoked keyRotate or unfreeze the key
402Insufficient account balance or key usage limit reachedAdd funds or reset/increase the key limit
403Model unavailable for the key or source IP rejected by an API allowlistUpdate key permissions or use an allowed source IP
404Unknown endpoint, model, or async requestCheck the identifier and path
413Request too largeReduce context size
429RPM or concurrency exceededHonor Retry-After
500Gateway errorRetry and inspect logs
502/503/504Upstream unavailable or timed outRetry with exponential backoff

Payment required

Insufficient company/account balance returns HTTP 402 Payment Required in the OpenAI-compatible envelope:

{
  "error": {
    "message": "Insufficient account balance.",
    "type": "payment_required",
    "code": "insufficient_balance"
  }
}

The same stable reason/code is recorded in Request History. A 402 request is rejected before provider execution and should not be automatically retried until funding or the applicable spending constraint has been corrected.

IP allowlist rejection

When an authenticated API key is valid but the source address is outside the effective personal or Business organization API allowlist, Model Gate rejects the request before upstream execution. OpenAI-compatible responses use HTTP 403 with code ip_not_allowed. Anthropic-compatible responses use the Anthropic error envelope with HTTP 403 and authentication_error. Do not retry from the same disallowed source; change the configured allowlist or send the request from an allowed address.

Retry 429 after Retry-After. Retry 500, 502, 503, and 504 up to three times with 1/2/4-second backoff. Do not automatically retry validation, authentication, balance, or not-found errors.

Use the request public ID from X-Request-ID to correlate the response with the request log.