Skip to content

Errors

ArtAPI uses standard OpenAI-compatible error responses.

Error Format

All errors follow this structure:

json
{
  "error": {
    "message": "Human-readable description of the error.",
    "type": "error_type",
    "code": "error_code"
  }
}

HTTP Status Codes

StatusTypeDescription
400invalid_request_errorBad request — missing or invalid parameters.
401authentication_errorInvalid or missing API key.
402billing_errorInsufficient credits. Top up at app.artapi.ai.
429rate_limit_errorToo many requests. Slow down or upgrade your plan.
500api_errorUpstream or internal server error. Retry after a delay.

Common Error Codes

CodeCauseFix
invalid_api_keyKey is malformed, revoked, or belongs to another accountCheck Settings → API Keys
model_not_foundModel ID doesn't exist or isn't available on your planSee Models
invalid_sizeRequested size not supported by the modelUse a supported size
prompt_too_longPrompt exceeds maximum character limitShorten your prompt
content_policy_violationPrompt or output violates usage policyRevise the prompt
insufficient_quotaNot enough creditsTop up at dashboard
upstream_errorProvider (fal.ai, OpenAI, etc.) returned an errorRetry with backoff

Handling Errors

python
from openai import OpenAI, APIError, AuthenticationError, RateLimitError

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://app.artapi.ai/v1",
)

try:
    response = client.images.generate(
        model="flux-dev",
        prompt="...",
    )
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit hit — back off and retry")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")

Retry strategy

For 500 and 429 errors, implement exponential backoff: wait 1s, 2s, 4s, 8s between retries. Give up after 4–5 attempts.

ArtAPI — Enterprise Image Generation