{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/octen-ai/json-schema/octen-ai-image-generation-response-schema.json",
  "title": "ImageGenerationResponse",
  "description": "A non-streaming image response. Images are always returned as base64.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/octen-ai-images-api-openapi.yml#/components/schemas/ImageGenerationResponse",
  "type": "object",
  "required": [
    "id",
    "created",
    "data",
    "usage"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique identifier for this request."
    },
    "created": {
      "type": "integer",
      "description": "Unix timestamp (in seconds) of when the request was created."
    },
    "background": {
      "type": "string",
      "enum": [
        "transparent",
        "opaque"
      ],
      "description": "(GPT only) The background setting actually applied."
    },
    "output_format": {
      "type": "string",
      "enum": [
        "png",
        "jpeg",
        "webp"
      ],
      "description": "The output format actually applied; for Gemini, derived from the mimeType."
    },
    "quality": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high",
        "xhigh",
        "max"
      ],
      "description": "(GPT only) The quality tier actually applied."
    },
    "size": {
      "type": "string",
      "description": "(GPT only) The output size actually applied; useful when `size` was `auto`."
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "b64_json": {
            "type": "string",
            "description": "Base64-encoded image content."
          }
        }
      },
      "description": "The generated images, one element per image."
    },
    "text": {
      "type": "string",
      "description": "(Gemini only) Plain-text summary of text the model produced alongside the image. For exact interleaving, read `parts`."
    },
    "parts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ImagePart"
      },
      "description": "(Gemini only) Content parts in the model's original order, preserving text/image interleaving."
    },
    "usage": {
      "$ref": "#/$defs/ImageUsage"
    }
  },
  "$defs": {
    "ImagePart": {
      "type": "object",
      "description": "An ordered content part preserving the original text/image interleaving.",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "image"
          ],
          "description": "The part type."
        },
        "text": {
          "type": "string",
          "description": "Text content. Present when `type` is `text`."
        },
        "index": {
          "type": "integer",
          "description": "Index into the `data` array. Present when `type` is `image`; read the image bytes from `data[index].b64_json`."
        }
      }
    },
    "ImageUsage": {
      "type": "object",
      "required": [
        "input_tokens",
        "output_tokens",
        "total_tokens"
      ],
      "description": "Token usage information.",
      "properties": {
        "input_tokens": {
          "type": "integer",
          "description": "Input tokens (text prompt + input image tokens)."
        },
        "input_tokens_details": {
          "type": "object",
          "properties": {
            "text_tokens": {
              "type": "integer",
              "description": "Text tokens of the prompt."
            },
            "image_tokens": {
              "type": "integer",
              "description": "Tokens of the input images."
            }
          }
        },
        "output_tokens": {
          "type": "integer",
          "description": "Output tokens (generated image tokens + reasoning text tokens)."
        },
        "output_tokens_details": {
          "type": "object",
          "properties": {
            "text_tokens": {
              "type": "integer",
              "description": "Output tokens used by reasoning text."
            },
            "image_tokens": {
              "type": "integer",
              "description": "Tokens of the generated images."
            }
          }
        },
        "total_tokens": {
          "type": "integer",
          "description": "Total tokens (input_tokens + output_tokens)."
        }
      }
    }
  }
}