DocsDeployment APIError Codes

Error Codes

Complete list of error codes and troubleshooting guidance.

Navigation

Error Codes

The Deployment API uses standard HTTP status codes and returns errors in a consistent JSON format compatible with the OpenAI error schema.

Error Response Format

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

Error Types

HTTP StatusTypeCodeDescription
400invalid_request_errorinvalid_jsonRequest body is not valid JSON
400invalid_request_errormissing_required_parameterA required field is missing (e.g., messages, prompt, input)
400invalid_request_errormodel_not_foundThe requested model is not available on this deployment
401invalid_request_errormissing_api_keyNo Authorization header or Bearer token provided
401authentication_errorinvalid_api_keyAPI key is invalid, revoked, or expired
429rate_limit_errorrate_limit_exceededToo many requests — wait and retry
500api_errorinternal_errorInternal server error during request processing
502api_errorbackend_unavailableCould not reach the deployment backend (may be starting up)
503invalid_request_errordeployment_not_runningDeployment is stopped or in a non-running state

Handling Errors

import openai

try:
    response = client.chat.completions.create(
        model="llama-4-scout",
        messages=[{"role": "user", "content": "Hello"}],
    )
except openai.AuthenticationError:
    print("Invalid API key. Check your mcy_live_* key.")
except openai.RateLimitError:
    print("Rate limited. Implement exponential backoff.")
except openai.APIConnectionError:
    print("Backend unavailable. Deployment may be starting.")
except openai.APIError as e:
    print(f"API error: {e.message}")