{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rendry-io/json-schema/rendry-io-generate-image-reply-schema.json",
  "title": "GenerateImageReply",
  "description": "Delivered images, actual charge and current balance. Partial success may include failed or refused entries. An identical retry returns saved assets without a new charge. Test keys return free placeholders without storing or calling the provider.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rendry-io-images-api-openapi.yml#/components/schemas/GenerateImageReply",
  "type": "object",
  "required": [
    "images",
    "credits_charged",
    "balance",
    "rules_version",
    "cached"
  ],
  "properties": {
    "images": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AIImageOutput"
      }
    },
    "credits_charged": {
      "type": "number"
    },
    "balance": {
      "type": [
        "number",
        "null"
      ],
      "description": "Null when the current balance could not be read."
    },
    "rules_version": {
      "type": "integer"
    },
    "cached": {
      "type": "boolean"
    },
    "placeholder": {
      "type": "boolean"
    },
    "money": {
      "type": "string"
    },
    "failed": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AIImageFailure"
      }
    },
    "refused": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AIImageFailure"
      }
    },
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "image_base64": {
      "type": "string",
      "description": "Inline preview bytes, base64 encoded; present when a preview is available."
    },
    "mime_type": {
      "type": "string"
    },
    "autofixed_fields": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "autofix_note": {
      "type": "string"
    }
  },
  "$defs": {
    "AIImageFailure": {
      "type": "object",
      "required": [
        "index",
        "reason",
        "message"
      ],
      "properties": {
        "index": {
          "type": "integer",
          "minimum": 0
        },
        "reason": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "description": "Image index and safe failure or refusal details; money explains whether refunds are complete."
    },
    "AIImageOutput": {
      "type": "object",
      "required": [
        "asset_id",
        "url",
        "storage_key",
        "width",
        "height",
        "cached"
      ],
      "properties": {
        "asset_id": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "storage_key": {
          "type": "string"
        },
        "width": {
          "type": "integer"
        },
        "height": {
          "type": "integer"
        },
        "cached": {
          "type": "boolean"
        }
      },
      "description": "An owned AI asset. Test placeholders have empty asset_id and storage_key and a public placeholder URL."
    }
  }
}