{
  "openapi": "3.1.0",
  "info": {
    "title": "HamuBox Media API",
    "version": "2026-10-23",
    "description": "Public asynchronous image/video API, Midjourney/Niji generation and follow-ups, and NovelAI task/streaming API. Model-specific examples target the documented groups, primarily default. Internal management and BYOK are out of scope. Only the listed NovelAI native paths are supported; this is not a complete official API replacement."
  },
  "servers": [
    {
      "url": "https://api.hamubox.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "video"
    },
    {
      "name": "image"
    },
    {
      "name": "novelai",
      "externalDocs": {
        "url": "https://api.hamubox.com/docs/novelai/overview/"
      }
    },
    {
      "name": "models"
    },
    {
      "name": "files"
    }
  ],
  "paths": {
    "/v1/media/files": {
      "post": {
        "operationId": "uploadMediaFile",
        "tags": [
          "files"
        ],
        "summary": "Upload reference media",
        "description": "Multipart upload, at most 512 MiB per file. Temporary by default for 24 hours from completion. Use the returned URL in image/video requests. Administrator archives do not replace that URL.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "temporary": {
                    "type": "boolean",
                    "default": true,
                    "description": "false saves a permanent user asset."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Uploaded file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaFile"
                }
              }
            }
          },
          "400": {
            "description": "Invalid upload or storage failure."
          },
          "413": {
            "description": "Request exceeds the upload size limit."
          }
        }
      }
    },
    "/v1/video/generations": {
      "post": {
        "operationId": "createVideoTask",
        "tags": [
          "video"
        ],
        "summary": "Create asynchronous video task",
        "description": "Submit once, save the returned id, then poll GET every 5 seconds. No documented idempotency-key, webhook or cancellation contract.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Seedance20"
                  },
                  {
                    "$ref": "#/components/schemas/Seedance20FastMini"
                  },
                  {
                    "$ref": "#/components/schemas/Seedance25"
                  },
                  {
                    "$ref": "#/components/schemas/Seedance25Final"
                  },
                  {
                    "$ref": "#/components/schemas/Wan3"
                  },
                  {
                    "$ref": "#/components/schemas/MidjourneyVideo"
                  }
                ]
              },
              "examples": {
                "midjourney-video-extend": {
                  "value": {
                    "model": "midjourney-video",
                    "operation": "extend",
                    "parent_task_id": "task_video_example",
                    "output_index": 0,
                    "prompt": "Continue the gentle camera movement",
                    "resolution": "480p",
                    "speed": "fast",
                    "n": 1
                  }
                },
                "midjourney-video-generate": {
                  "value": {
                    "model": "midjourney-video",
                    "images": [
                      "https://example.com/start.png"
                    ],
                    "prompt": "The camera slowly moves forward through the greenhouse",
                    "resolution": "480p",
                    "speed": "fast",
                    "motion": "low",
                    "n": 2
                  }
                },
                "seedance-draft-final": {
                  "value": {
                    "model": "doubao-seedance-2-5-260628",
                    "draft_task_id": "task_replace_with_your_completed_draft_id",
                    "resolution": "1080p",
                    "watermark": false
                  }
                },
                "seedance-draft": {
                  "value": {
                    "model": "doubao-seedance-2-5-260628",
                    "prompt": "A red cube slowly rotates on a table, fixed camera.",
                    "duration": 4,
                    "aspect_ratio": "16:9",
                    "resolution": "480p",
                    "draft": true,
                    "audio": false,
                    "watermark": false
                  }
                },
                "seedance-edit": {
                  "value": {
                    "model": "dreamina-seedance-2-5-ep",
                    "prompt": "Edit the video: replace the background with a snowy city, preserve the camera movement.",
                    "mode": "multi_ref",
                    "omni_reference_task_type": "edit",
                    "image_urls": [
                      "https://example.com/background.png"
                    ],
                    "reference_video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "metadata": {
                      "reference_video_seconds": 8.4
                    },
                    "duration": -1,
                    "resolution": "720p",
                    "aspect_ratio": "adaptive"
                  }
                },
                "seedance-extend": {
                  "value": {
                    "model": "dreamina-seedance-2-5-ep",
                    "prompt": "Extend the video: continue the camera movement as the character walks toward the snowy city.",
                    "mode": "multi_ref",
                    "omni_reference_task_type": "extend",
                    "reference_video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "metadata": {
                      "reference_video_seconds": 8.4
                    },
                    "duration": 10,
                    "resolution": "720p",
                    "aspect_ratio": "adaptive"
                  }
                },
                "seedance-frames": {
                  "value": {
                    "model": "dreamina-seedance-2-5-ep",
                    "prompt": "The character turns slowly toward the camera. Keep the face and outfit consistent.",
                    "mode": "first_last_frame",
                    "first_frame_url": "https://example.com/first.png",
                    "last_frame_url": "https://example.com/last.png",
                    "duration": 8,
                    "resolution": "1080p",
                    "aspect_ratio": "adaptive",
                    "audio": true
                  }
                },
                "seedance-reference": {
                  "value": {
                    "model": "dreamina-seedance-2-5-ep",
                    "prompt": "Keep the character from image 1, follow the movement in video 1 and the mood of audio 1.",
                    "mode": "multi_ref",
                    "image_urls": [
                      "https://example.com/character.png"
                    ],
                    "reference_video_urls": [
                      "https://example.com/motion.mp4"
                    ],
                    "reference_audio_urls": [
                      "https://example.com/music.mp3"
                    ],
                    "metadata": {
                      "reference_video_seconds": 8.4,
                      "reference_audio_seconds": 6
                    },
                    "duration": 10,
                    "resolution": "720p",
                    "aspect_ratio": "9:16",
                    "audio": true
                  }
                },
                "seedance-tail": {
                  "value": {
                    "model": "dreamina-seedance-2-0-fast-ep",
                    "prompt": "The camera slowly approaches the final composition.",
                    "mode": "first_last_frame",
                    "last_frame_url": "https://example.com/last.png",
                    "duration": 5,
                    "resolution": "720p",
                    "aspect_ratio": "adaptive"
                  }
                },
                "seedance-text": {
                  "value": {
                    "model": "dreamina-seedance-2-0-ep",
                    "prompt": "A slow aerial shot over a green valley at sunrise, natural light, steady camera.",
                    "duration": 5,
                    "resolution": "720p",
                    "aspect_ratio": "16:9",
                    "audio": true,
                    "watermark": false
                  }
                },
                "wan-frames": {
                  "value": {
                    "model": "wan3.0-video-ep",
                    "prompt": "A smooth transition from the first image to the final image.",
                    "mode": "first_last_frame",
                    "first_frame_url": "https://example.com/first.png",
                    "last_frame_url": "https://example.com/last.png",
                    "duration": 8,
                    "resolution": "1080p",
                    "aspect_ratio": "16:9",
                    "audio": true
                  }
                },
                "wan-reference": {
                  "value": {
                    "model": "wan3.0-video-ep",
                    "prompt": "Animate the character in image 1, following the camera motion in video 1.",
                    "mode": "multi_ref",
                    "image_urls": [
                      "https://example.com/character.png"
                    ],
                    "reference_video_urls": [
                      "https://example.com/motion.mp4"
                    ],
                    "duration": 12,
                    "resolution": "1080p",
                    "aspect_ratio": "16:9",
                    "audio": true,
                    "prompt_extend": false
                  }
                },
                "wan-text": {
                  "value": {
                    "model": "wan3.0-video-ep",
                    "prompt": "A paper boat drifting across a quiet lake, cinematic lighting.",
                    "mode": "text",
                    "duration": 7,
                    "resolution": "720p",
                    "aspect_ratio": "16:9",
                    "audio": true,
                    "prompt_extend": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read status. HTTP 200 is not proof of generation success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/video/generations/{task_id}": {
      "get": {
        "operationId": "getVideoTask",
        "tags": [
          "video"
        ],
        "summary": "Query video task",
        "description": "Results: outputs[].url; metadata.url is the first video for compatibility. Generation ends on completed or failed. For Midjourney platform-hosted URLs, continue polling metadata.result_transfer_status until stored; failed persistence does not mean generation failed.",
        "parameters": [
          {
            "in": "path",
            "name": "task_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public ID returned by submit, not an upstream ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Read status. HTTP 200 is not proof of generation success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/video/generations/estimate": {
      "post": {
        "operationId": "estimateMidjourneyVideo",
        "tags": [
          "video"
        ],
        "summary": "Estimate Midjourney video or Seedance draft cost",
        "description": "No generation or charge. Supports Midjourney video, Seedance draft:true (480p), and Seedance final generation from draft_task_id (1080p). Use the same parameters for submission; max_cost_usd guards the submitted hold.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MidjourneyVideo"
                  },
                  {
                    "$ref": "#/components/schemas/Seedance25Final"
                  },
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Seedance25"
                      },
                      {
                        "required": [
                          "draft"
                        ],
                        "properties": {
                          "draft": {
                            "const": true
                          }
                        }
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current quote in USD and quota units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MidjourneyEstimate"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/image/generations": {
      "post": {
        "operationId": "createImageTask",
        "tags": [
          "image"
        ],
        "summary": "Create asynchronous image task",
        "description": "Submit once, save the returned id, then poll GET every 5 seconds. No documented idempotency-key, webhook or cancellation contract.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Seedream"
                  },
                  {
                    "$ref": "#/components/schemas/GPTImage2"
                  },
                  {
                    "$ref": "#/components/schemas/Banana"
                  },
                  {
                    "$ref": "#/components/schemas/MidjourneyImage"
                  }
                ]
              },
              "examples": {
                "banana-custom": {
                  "value": {
                    "model": "nano-banana-pro",
                    "prompt": "A peaceful garden, wide composition.",
                    "resolution": "custom",
                    "size": "1536x1024",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "banana-edit": {
                  "value": {
                    "model": "nano-banana-2",
                    "prompt": "Change the teapot color to blue, keep the composition unchanged.",
                    "images": [
                      "https://example.com/reference.png"
                    ],
                    "resolution": "1k",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "banana-generate": {
                  "value": {
                    "model": "nano-banana-pro",
                    "prompt": "A red ceramic teapot on a white table, soft daylight, no text.",
                    "aspect_ratio": "3:2",
                    "resolution": "2k",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "gpt-custom": {
                  "value": {
                    "model": "gpt-image-2",
                    "prompt": "A peaceful garden, wide composition.",
                    "resolution": "custom",
                    "size": "1536x1024",
                    "quality": "auto",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "gpt-edit": {
                  "value": {
                    "model": "gpt-image-2",
                    "prompt": "Change the teapot color to blue. Keep the composition unchanged.",
                    "images": [
                      "https://example.com/reference.png"
                    ],
                    "size": "auto",
                    "quality": "high",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "gpt-generate": {
                  "value": {
                    "model": "gpt-image-2",
                    "prompt": "A red teapot on a white table, clean product photograph.",
                    "aspect_ratio": "3:2",
                    "resolution": "2k",
                    "quality": "auto",
                    "moderation": "auto",
                    "output_format": "png",
                    "n": 1
                  }
                },
                "midjourney-image-describe": {
                  "value": {
                    "model": "midjourney-v7",
                    "operation": "describe",
                    "images": [
                      "https://example.com/source.png"
                    ]
                  }
                },
                "midjourney-image-edit": {
                  "value": {
                    "model": "midjourney-v8.2",
                    "operation": "edit",
                    "prompt": "Change the greenhouse into a winter garden, preserve the traveler",
                    "images": [
                      "https://example.com/source.png"
                    ],
                    "speed": "fast"
                  }
                },
                "midjourney-image-generate": {
                  "value": {
                    "model": "midjourney-v7",
                    "prompt": "A quiet greenhouse at sunrise, soft watercolor illustration",
                    "speed": "fast",
                    "generation_mode": "standard",
                    "aspect_ratio": "3:2",
                    "stylize": 100,
                    "seed": 0,
                    "raw": false,
                    "n": 1
                  }
                },
                "midjourney-image-native": {
                  "value": {
                    "model": "midjourney-v7",
                    "prompt": "A quiet greenhouse at sunrise --v 7 --ar 16:9 --s 150 --chaos 0 --seed 42 --raw --no text, watermark --fast",
                    "aspect_ratio": "1:1",
                    "speed": "relax",
                    "n": 1
                  }
                },
                "midjourney-image-reference": {
                  "value": {
                    "model": "midjourney-v7",
                    "prompt": "A traveler standing in a sunlit greenhouse",
                    "speed": "fast",
                    "style_references": [
                      "https://example.com/style.png"
                    ],
                    "style_weight": 100,
                    "omni_reference": "https://example.com/character.png",
                    "omni_weight": 100
                  }
                },
                "midjourney-image-upscale": {
                  "value": {
                    "model": "midjourney-v7",
                    "operation": "upscale_subtle",
                    "parent_task_id": "task_selected_image",
                    "output_index": 0,
                    "speed": "fast"
                  }
                },
                "midjourney-image-variation": {
                  "value": {
                    "model": "midjourney-v7",
                    "operation": "variation",
                    "parent_task_id": "task_example",
                    "output_index": 0
                  }
                },
                "seedream-edit": {
                  "value": {
                    "model": "dola-seedream-5-0-pro-ep",
                    "prompt": "Keep the composition and character, change the background to a snowy train station.",
                    "images": [
                      "https://example.com/reference.png"
                    ],
                    "resolution": "1k",
                    "output_format": "png"
                  }
                },
                "seedream-generate": {
                  "value": {
                    "model": "dola-seedream-5-0-pro-ep",
                    "prompt": "A quiet futuristic city after rain, cinematic lighting, no text.",
                    "aspect_ratio": "16:9",
                    "resolution": "2k",
                    "output_format": "png"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read status. HTTP 200 is not proof of generation success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageTask"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/image/generations/{task_id}": {
      "get": {
        "operationId": "getImageTask",
        "tags": [
          "image"
        ],
        "summary": "Query image task",
        "description": "Results: outputs[].url, or descriptions[] for Midjourney describe. Generation ends on completed or failed. For Midjourney platform-hosted URLs, continue polling result_transfer_status until stored; failed persistence does not mean generation failed.",
        "parameters": [
          {
            "in": "path",
            "name": "task_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public ID returned by submit, not an upstream ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Read status. HTTP 200 is not proof of generation success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageTask"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/image/generations/estimate": {
      "post": {
        "operationId": "estimateMidjourneyImage",
        "tags": [
          "image"
        ],
        "summary": "Estimate Midjourney image cost",
        "description": "Midjourney only. Use the same request as submission, including parent/speed/mode/count. Does not create or generate a task. Price is not reserved; optional max_cost_usd guards actual submission.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MidjourneyImage"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current quote in USD and quota units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MidjourneyEstimate"
                }
              }
            }
          },
          "default": {
            "description": "Request error. Preserve HTTP status and error message. POST retry is not guaranteed idempotent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    },
                    "code": {
                      "type": [
                        "string",
                        "number"
                      ]
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models available to this API Key",
        "tags": [
          "models"
        ],
        "responses": {
          "200": {
            "description": "Availability, not a full capability schema.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/estimate": {
      "post": {
        "operationId": "estimateNovelAITask",
        "tags": [
          "novelai"
        ],
        "summary": "Estimate NovelAI cost without generation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAITaskEstimateRequest"
              },
              "examples": {
                "novelai-director": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "director",
                    "payload": {
                      "req_type": "lineart",
                      "image": "https://example.com/source.png",
                      "width": 512,
                      "height": 512
                    }
                  }
                },
                "novelai-generate": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "operation": "generation",
                    "stream": true,
                    "payload": {
                      "input": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                      "model": "nai-diffusion-5-curated",
                      "action": "generate",
                      "parameters": {
                        "params_version": 4,
                        "width": 832,
                        "height": 1216,
                        "steps": 23,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "image_format": "png",
                        "uc": "lowres, blurry",
                        "v4_prompt": {
                          "caption": {
                            "base_caption": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                            "char_captions": []
                          },
                          "use_coords": false,
                          "use_order": true
                        },
                        "v4_negative_prompt": {
                          "caption": {
                            "base_caption": "lowres, blurry",
                            "char_captions": []
                          },
                          "use_coords": false,
                          "use_order": false
                        }
                      }
                    }
                  }
                },
                "novelai-img2img": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "operation": "generation",
                    "payload": {
                      "input": "a blue ceramic cup, watercolor illustration",
                      "model": "nai-diffusion-5-curated",
                      "action": "img2img",
                      "parameters": {
                        "params_version": 4,
                        "width": 832,
                        "height": 1216,
                        "steps": 23,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "uc": "lowres, blurry",
                        "v4_prompt": {
                          "caption": {
                            "base_caption": "a blue ceramic cup, watercolor illustration",
                            "char_captions": []
                          }
                        },
                        "v4_negative_prompt": {
                          "caption": {
                            "base_caption": "lowres, blurry",
                            "char_captions": []
                          }
                        },
                        "image": "https://example.com/source.png",
                        "strength": 0.6,
                        "noise": 0,
                        "extra_noise_seed": 42,
                        "img2img": {
                          "strength": 0.6,
                          "color_correct": true
                        }
                      }
                    }
                  }
                },
                "novelai-inpaint": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "generation",
                    "payload": {
                      "input": "a blue ceramic cup on a wooden table",
                      "model": "nai-diffusion-4-5-full-inpainting",
                      "action": "infill",
                      "parameters": {
                        "params_version": 3,
                        "width": 832,
                        "height": 1216,
                        "steps": 28,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "image": "https://example.com/source.png",
                        "mask": "https://example.com/mask.png",
                        "inpaintImg2ImgStrength": 0.7,
                        "img2img": {
                          "strength": 0.7,
                          "color_correct": true
                        }
                      }
                    }
                  }
                },
                "novelai-upscale": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "upscale",
                    "payload": {
                      "image": "https://example.com/source.png",
                      "model": "nai-diffusion-5-curated",
                      "declared_blur_sigma": 0,
                      "width": 512,
                      "height": 512,
                      "scale": 2
                    }
                  }
                },
                "novelai-vibe": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "encode-vibe",
                    "payload": {
                      "model": "nai-diffusion-4-5-full",
                      "image": "https://example.com/style.png",
                      "information_extracted": 1
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current estimate; not a price guarantee or account balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAIEstimate"
                }
              }
            }
          },
          "default": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/tasks": {
      "post": {
        "operationId": "createNovelAITask",
        "tags": [
          "novelai"
        ],
        "summary": "Submit an asynchronous NovelAI task",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAITaskRequest"
              },
              "examples": {
                "novelai-director": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "director",
                    "payload": {
                      "req_type": "lineart",
                      "image": "https://example.com/source.png",
                      "width": 512,
                      "height": 512
                    }
                  }
                },
                "novelai-generate": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "operation": "generation",
                    "stream": true,
                    "payload": {
                      "input": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                      "model": "nai-diffusion-5-curated",
                      "action": "generate",
                      "parameters": {
                        "params_version": 4,
                        "width": 832,
                        "height": 1216,
                        "steps": 23,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "image_format": "png",
                        "uc": "lowres, blurry",
                        "v4_prompt": {
                          "caption": {
                            "base_caption": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                            "char_captions": []
                          },
                          "use_coords": false,
                          "use_order": true
                        },
                        "v4_negative_prompt": {
                          "caption": {
                            "base_caption": "lowres, blurry",
                            "char_captions": []
                          },
                          "use_coords": false,
                          "use_order": false
                        }
                      }
                    }
                  }
                },
                "novelai-img2img": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "operation": "generation",
                    "payload": {
                      "input": "a blue ceramic cup, watercolor illustration",
                      "model": "nai-diffusion-5-curated",
                      "action": "img2img",
                      "parameters": {
                        "params_version": 4,
                        "width": 832,
                        "height": 1216,
                        "steps": 23,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "uc": "lowres, blurry",
                        "v4_prompt": {
                          "caption": {
                            "base_caption": "a blue ceramic cup, watercolor illustration",
                            "char_captions": []
                          }
                        },
                        "v4_negative_prompt": {
                          "caption": {
                            "base_caption": "lowres, blurry",
                            "char_captions": []
                          }
                        },
                        "image": "https://example.com/source.png",
                        "strength": 0.6,
                        "noise": 0,
                        "extra_noise_seed": 42,
                        "img2img": {
                          "strength": 0.6,
                          "color_correct": true
                        }
                      }
                    }
                  }
                },
                "novelai-inpaint": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "generation",
                    "payload": {
                      "input": "a blue ceramic cup on a wooden table",
                      "model": "nai-diffusion-4-5-full-inpainting",
                      "action": "infill",
                      "parameters": {
                        "params_version": 3,
                        "width": 832,
                        "height": 1216,
                        "steps": 28,
                        "scale": 5,
                        "sampler": "k_euler_ancestral",
                        "noise_schedule": "karras",
                        "seed": 42,
                        "n_samples": 1,
                        "image": "https://example.com/source.png",
                        "mask": "https://example.com/mask.png",
                        "inpaintImg2ImgStrength": 0.7,
                        "img2img": {
                          "strength": 0.7,
                          "color_correct": true
                        }
                      }
                    }
                  }
                },
                "novelai-upscale": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "upscale",
                    "payload": {
                      "image": "https://example.com/source.png",
                      "model": "nai-diffusion-5-curated",
                      "declared_blur_sigma": 0,
                      "width": 512,
                      "height": 512,
                      "scale": 2
                    }
                  }
                },
                "novelai-vibe": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "operation": "encode-vibe",
                    "payload": {
                      "model": "nai-diffusion-4-5-full",
                      "image": "https://example.com/style.png",
                      "information_extracted": 1
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "responses": {
          "202": {
            "description": "Task state; completed/failed are terminal. Result images use result.images[].url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAITask"
                }
              }
            }
          },
          "default": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/tasks/{task_id}": {
      "get": {
        "operationId": "getNovelAITask",
        "tags": [
          "novelai"
        ],
        "summary": "Read NovelAI result and settlement",
        "parameters": [
          {
            "in": "path",
            "name": "task_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Task ID owned by the authenticated user."
          }
        ],
        "responses": {
          "200": {
            "description": "Task state; completed/failed are terminal. Result images use result.images[].url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAITask"
                }
              }
            }
          },
          "default": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/tasks/{task_id}/events": {
      "get": {
        "operationId": "streamNovelAITaskEvents",
        "tags": [
          "novelai"
        ],
        "summary": "Observe a task through SSE",
        "parameters": [
          {
            "in": "path",
            "name": "task_id",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Task ID owned by the authenticated user."
          }
        ],
        "description": "state: full task JSON; preview: {step,sample,image:DataURL}; image: {sample,filename,image:DataURL}. Final image can arrive before storage/settlement. No guaranteed event replay. Disconnect does not cancel. Resume by GET, never re-POST.",
        "responses": {
          "200": {
            "description": "SSE with comment heartbeats, up to 10 minutes per connection.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/generate-image-stream": {
      "post": {
        "operationId": "generateNovelAINativeStream",
        "tags": [
          "novelai"
        ],
        "summary": "Generate with official-format framed MessagePack",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "Each frame is uint32 big-endian length + MessagePack map. Events: intermediate, final, error, heartbeat. image is binary, not Base64. A final image does not mean storage/settlement is complete; query X-NovelAI-Task-Id. Not a ZIP, JSON or SSE response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAINativeRequest"
              },
              "examples": {
                "generation": {
                  "value": {
                    "input": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                    "model": "nai-diffusion-5-curated",
                    "action": "generate",
                    "parameters": {
                      "params_version": 4,
                      "width": 832,
                      "height": 1216,
                      "steps": 23,
                      "scale": 5,
                      "sampler": "k_euler_ancestral",
                      "noise_schedule": "karras",
                      "seed": 42,
                      "n_samples": 1,
                      "stream": "msgpack",
                      "image_format": "png",
                      "uc": "lowres, blurry",
                      "v4_prompt": {
                        "caption": {
                          "base_caption": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                          "char_captions": []
                        },
                        "use_coords": false,
                        "use_order": true
                      },
                      "v4_negative_prompt": {
                        "caption": {
                          "base_caption": "lowres, blurry",
                          "char_captions": []
                        },
                        "use_coords": false,
                        "use_order": false
                      }
                    }
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "description": "JSON text or Blob matching NovelAINativeRequest. parameters.image/mask reference the binary field names."
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Frames up to 32 MiB each. A stream error may follow HTTP 200. Missing final is not success.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "description": "Persist before reading frames; use the regular NovelAI task query to recover.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/msgpack": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/generate-image": {
      "post": {
        "operationId": "generateNovelAINative",
        "tags": [
          "novelai"
        ],
        "summary": "Official NovelAI image operation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAINativeGeneration"
              },
              "examples": {
                "novelai-native-generate": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "input": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                    "action": "generate",
                    "parameters": {
                      "params_version": 4,
                      "width": 832,
                      "height": 1216,
                      "steps": 23,
                      "scale": 5,
                      "sampler": "k_euler_ancestral",
                      "noise_schedule": "karras",
                      "seed": 42,
                      "n_samples": 1,
                      "image_format": "png",
                      "uc": "lowres, blurry",
                      "v4_prompt": {
                        "caption": {
                          "base_caption": "a blue ceramic cup on a wooden table, soft daylight, illustration",
                          "char_captions": []
                        },
                        "use_coords": false,
                        "use_order": true
                      },
                      "v4_negative_prompt": {
                        "caption": {
                          "base_caption": "lowres, blurry",
                          "char_captions": []
                        },
                        "use_coords": false,
                        "use_order": false
                      }
                    }
                  }
                },
                "novelai-native-img2img": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "input": "a blue ceramic cup, watercolor illustration",
                    "action": "img2img",
                    "parameters": {
                      "params_version": 4,
                      "width": 832,
                      "height": 1216,
                      "steps": 23,
                      "scale": 5,
                      "sampler": "k_euler_ancestral",
                      "noise_schedule": "karras",
                      "seed": 42,
                      "n_samples": 1,
                      "uc": "lowres, blurry",
                      "v4_prompt": {
                        "caption": {
                          "base_caption": "a blue ceramic cup, watercolor illustration",
                          "char_captions": []
                        }
                      },
                      "v4_negative_prompt": {
                        "caption": {
                          "base_caption": "lowres, blurry",
                          "char_captions": []
                        }
                      },
                      "image": "https://example.com/source.png",
                      "strength": 0.6,
                      "noise": 0,
                      "extra_noise_seed": 42,
                      "img2img": {
                        "strength": 0.6,
                        "color_correct": true
                      }
                    }
                  }
                },
                "novelai-native-inpaint": {
                  "value": {
                    "model": "nai-diffusion-4-5-full-inpainting",
                    "input": "a blue ceramic cup on a wooden table",
                    "action": "infill",
                    "parameters": {
                      "params_version": 3,
                      "width": 832,
                      "height": 1216,
                      "steps": 28,
                      "scale": 5,
                      "sampler": "k_euler_ancestral",
                      "noise_schedule": "karras",
                      "seed": 42,
                      "n_samples": 1,
                      "image": "https://example.com/source.png",
                      "mask": "https://example.com/mask.png",
                      "inpaintImg2ImgStrength": 0.7,
                      "img2img": {
                        "strength": 0.7,
                        "color_correct": true
                      }
                    }
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "description": "JSON text or Blob matching NovelAINativeGeneration. Binary fields are referenced by name."
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "Uses platform authentication, billing, task history and asset storage. No asynchronous request wrapper. Disconnect does not cancel; query the returned task ID before retrying.",
        "responses": {
          "200": {
            "description": "Binary result; storage and settlement may still be in progress.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/augment-image": {
      "post": {
        "operationId": "augmentNovelAINative",
        "tags": [
          "novelai"
        ],
        "summary": "Official NovelAI image operation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAINativeDirector"
              },
              "examples": {
                "novelai-native-director": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "req_type": "lineart",
                    "image": "https://example.com/source.png",
                    "width": 512,
                    "height": 512
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "description": "JSON text or Blob matching NovelAINativeDirector. Binary fields are referenced by name."
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "Uses platform authentication, billing, task history and asset storage. No asynchronous request wrapper. Disconnect does not cancel; query the returned task ID before retrying.",
        "responses": {
          "200": {
            "description": "Binary result; storage and settlement may still be in progress.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/upscale": {
      "post": {
        "operationId": "upscaleNovelAINative",
        "tags": [
          "novelai"
        ],
        "summary": "Official NovelAI image operation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAINativeUpscale"
              },
              "examples": {
                "novelai-native-upscale": {
                  "value": {
                    "model": "nai-diffusion-5-curated",
                    "image": "https://example.com/source.png",
                    "declared_blur_sigma": 0,
                    "width": 512,
                    "height": 512,
                    "scale": 2
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "description": "JSON text or Blob matching NovelAINativeUpscale. Binary fields are referenced by name."
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "Uses platform authentication, billing, task history and asset storage. No asynchronous request wrapper. Disconnect does not cancel; query the returned task ID before retrying.",
        "responses": {
          "200": {
            "description": "Binary result; storage and settlement may still be in progress.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/encode-vibe": {
      "post": {
        "operationId": "encodeNovelAINativeVibe",
        "tags": [
          "novelai"
        ],
        "summary": "Official NovelAI image operation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAINativeVibe"
              },
              "examples": {
                "novelai-native-vibe": {
                  "value": {
                    "model": "nai-diffusion-4-5-full",
                    "image": "https://example.com/style.png",
                    "information_extracted": 1
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "description": "JSON text or Blob matching NovelAINativeVibe. Binary fields are referenced by name."
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "Uses platform authentication, billing, task history and asset storage. No asynchronous request wrapper. Disconnect does not cancel; query the returned task ID before retrying.",
        "responses": {
          "200": {
            "description": "Binary result; storage and settlement may still be in progress.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/generate-image/request-price": {
      "post": {
        "operationId": "priceNovelAINative",
        "tags": [
          "novelai"
        ],
        "summary": "Native-shaped platform quote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "request"
                ],
                "properties": {
                  "tier": {
                    "type": "string",
                    "description": "Accepted for compatibility; cannot override platform pricing."
                  },
                  "request": {
                    "$ref": "#/components/schemas/NovelAINativePricingRequest"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "1000 display units = USD 1. Includes platform fees/ratios. No free prompts. hamubox.estimatedCostUSD is the precise estimate.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "costPerPrompt": {
                      "type": "integer"
                    },
                    "numPrompts": {
                      "type": "integer"
                    },
                    "freePrompts": {
                      "const": 0
                    },
                    "requestEligibleForUnlimitedGeneration": {
                      "const": false
                    },
                    "hamubox": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/generate-image/suggest-tags": {
      "get": {
        "operationId": "suggestNovelAINativeTags",
        "tags": [
          "novelai"
        ],
        "summary": "Official tag suggestions",
        "parameters": [
          {
            "in": "query",
            "name": "model",
            "schema": {
              "type": "string",
              "enum": [
                "nai-diffusion-5-curated",
                "nai-diffusion-5-full",
                "nai-diffusion-5-full-inpainting",
                "nai-diffusion-5-full-medium",
                "nai-diffusion-5-full-medium-inpainting",
                "nai-diffusion-4-5-curated",
                "nai-diffusion-4-5-curated-inpainting",
                "nai-diffusion-4-5-full",
                "nai-diffusion-4-5-full-inpainting",
                "nai-diffusion-4-curated-preview",
                "nai-diffusion-4-curated-inpainting",
                "nai-diffusion-4-full",
                "nai-diffusion-4-full-inpainting",
                "nai-diffusion-3",
                "nai-diffusion-3-inpainting",
                "nai-diffusion-furry-3",
                "nai-diffusion-furry-3-inpainting"
              ]
            }
          },
          {
            "in": "query",
            "name": "prompt",
            "schema": {
              "type": "string",
              "maxLength": 20000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider tag suggestion JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/user/data": {
      "get": {
        "operationId": "getNovelAINativeAccount",
        "tags": [
          "novelai"
        ],
        "summary": "Virtual account for the authenticated platform user",
        "description": "Never returns upstream account data or V5 battery. tier 3 enables client UI only; not an actual official subscription. trainingStepsLeft uses 1000 display units per USD, capped by the API key quota.",
        "responses": {
          "200": {
            "description": "Official-shaped compatibility JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/user/subscription": {
      "get": {
        "operationId": "getNovelAINativeSubscription",
        "tags": [
          "novelai"
        ],
        "summary": "Virtual account for the authenticated platform user",
        "description": "Never returns upstream account data or V5 battery. tier 3 enables client UI only; not an actual official subscription. trainingStepsLeft uses 1000 display units per USD, capped by the API key quota.",
        "responses": {
          "200": {
            "description": "Official-shaped compatibility JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/user/priority": {
      "get": {
        "operationId": "getNovelAINativePriority",
        "tags": [
          "novelai"
        ],
        "summary": "Virtual account for the authenticated platform user",
        "description": "Never returns upstream account data or V5 battery. tier 3 enables client UI only; not an actual official subscription. trainingStepsLeft uses 1000 display units per USD, capped by the API key quota.",
        "responses": {
          "200": {
            "description": "Official-shaped compatibility JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/novelai/ai/user/subscription": {
      "get": {
        "operationId": "getNovelAINativeSubscriptionCompat",
        "tags": [
          "novelai"
        ],
        "summary": "Virtual account for the authenticated platform user",
        "description": "Never returns upstream account data or V5 battery. tier 3 enables client UI only; not an actual official subscription. trainingStepsLeft uses 1000 display units per USD, capped by the API key quota.",
        "responses": {
          "200": {
            "description": "Official-shaped compatibility JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "Official-shaped JSON error. INVALID_CACHE_KEYS includes details.invalidKeys for resending missing reference data before generation. Do not blindly retry submitted tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NovelAINativeError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "generateNovelAIOpenAIImage",
        "tags": [
          "novelai"
        ],
        "summary": "NovelAI single-image compatibility with OpenAI Images",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Unique per user generation intent. Same user/operation/key and normalized body returns the original task/result. Different body returns 409. An admission still in progress returns 409 with Retry-After. Reuse the key on network retries; never silently generate with a new key."
          }
        ],
        "description": "This documented subset applies to NovelAI models only. Uses the existing NAI queue/billing/assets, not a separate image tariff. Waits up to 10 minutes for a stored result; disconnect does not cancel. Recover using X-NovelAI-Task-Id. Other model protocols on this path are unchanged.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NovelAIOpenAIImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored image URL or original image bytes as Base64, retaining PNG metadata.",
            "headers": {
              "X-NovelAI-Task-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "created",
                    "data"
                  ],
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "minItems": 1,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "required": [
                              "url"
                            ],
                            "properties": {
                              "url": {
                                "type": "string",
                                "pattern": "^https?://"
                              }
                            }
                          },
                          {
                            "type": "object",
                            "required": [
                              "b64_json"
                            ],
                            "properties": {
                              "b64_json": {
                                "type": "string"
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "JSON error before stream headers are sent. Invalid generation parameters return HTTP 400 with field paths, before queueing or precharge. Middleware authentication errors may use another error type. Do not automatically retry POST.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "$ref": "#/components/schemas/TaskError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "MidjourneyImage": {
        "type": "object",
        "required": [
          "model"
        ],
        "additionalProperties": false,
        "description": "One job, potentially multiple image outputs. References do not automatically select edit. Follow-up operation/index must exist in the completed parent actions. Live pricing, parent ownership and model compatibility are verified on the server; see the Midjourney guide.",
        "properties": {
          "speed": {
            "type": "string",
            "enum": [
              "fast",
              "relax"
            ],
            "description": "Explicit speed recommended. Omitted follow-up speed inherits the parent when available; otherwise the route default applies."
          },
          "max_cost_usd": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000,
            "description": "Submission price ceiling in USD. A higher quote is rejected with HTTP 409."
          },
          "model": {
            "type": "string",
            "enum": [
              "midjourney-v6",
              "midjourney-v6.1",
              "midjourney-v7",
              "midjourney-v8.1",
              "midjourney-v8.2",
              "niji-v6",
              "niji-v7"
            ]
          },
          "prompt": {
            "type": "string",
            "maxLength": 4000,
            "pattern": "^[^{}]*$",
            "description": "Text followed by supported native MJ parameters is accepted. Suffix parameters override corresponding JSON creative fields before pricing; model, permissions, one-job limit and max_cost_usd cannot be overridden. Leading image URLs replace images. Runtime validation checks the normalized request, including model-specific restrictions; see the Midjourney guide."
          },
          "operation": {
            "type": "string",
            "enum": [
              "generate",
              "edit",
              "retexture",
              "blend",
              "describe",
              "select",
              "variation",
              "reroll",
              "upscale_subtle",
              "upscale_creative",
              "vary_subtle",
              "vary_strong",
              "zoom_1_5",
              "zoom_2",
              "pan_left",
              "pan_right",
              "pan_up",
              "pan_down",
              "custom_zoom",
              "region"
            ],
            "default": "generate"
          },
          "images": {
            "type": "array",
            "minItems": 0,
            "maxItems": 4,
            "items": {
              "type": "string",
              "pattern": "^https?://[^\\s{}]+$",
              "description": "Downloadable HTTP(S) image URL, without credentials. No data:, blob: or local paths."
            }
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "2:3",
              "3:2",
              "3:4",
              "4:3",
              "9:16",
              "16:9"
            ]
          },
          "generation_mode": {
            "type": "string",
            "enum": [
              "standard",
              "draft",
              "hd"
            ],
            "default": "standard"
          },
          "stylize": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "chaos": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4294967295
          },
          "raw": {
            "type": "boolean"
          },
          "negative_prompt": {
            "type": "string",
            "maxLength": 4000,
            "pattern": "^(?![\\s\\S]*(?:^|\\s)--\\S)[^{}\\u0000-\\u001f\\u007f-\\u009f]*$",
            "description": "Generate only. Excluded content, equivalent to --no; not a place for additional flags."
          },
          "image_weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 3,
            "description": "Generate with ordinary image references; 0-3, or 0-2 for Niji V7."
          },
          "tile": {
            "type": "boolean",
            "description": "Generate only. Seamless repeating pattern."
          },
          "weird": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3000,
            "description": "Generate only. Not supported by Niji."
          },
          "n": {
            "type": "integer",
            "const": 1,
            "description": "One image job/group, not necessarily one output image."
          },
          "parent_task_id": {
            "type": "string",
            "pattern": "^task_",
            "maxLength": 128
          },
          "output_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 23
          },
          "zoom": {
            "type": "number",
            "minimum": 1,
            "maximum": 2
          },
          "mask": {
            "type": "string",
            "pattern": "^data:image/png;base64,",
            "maxLength": 8388608,
            "description": "Valid PNG Data URL; each dimension 1-8192. Only for region."
          },
          "style_references": {
            "type": "array",
            "minItems": 0,
            "maxItems": 4,
            "items": {
              "type": "string",
              "pattern": "^https?://[^\\s{}]+$",
              "description": "Downloadable HTTP(S) image URL, without credentials. No data:, blob: or local paths."
            }
          },
          "style_codes": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[0-9]{1,20}$"
            }
          },
          "style_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6,
            "description": "V6/V6.1: 1-4; V7: 1-6 with images, 4 or 6 with codes. Omit for other models."
          },
          "style_weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "character_references": {
            "type": "array",
            "minItems": 0,
            "maxItems": 4,
            "items": {
              "type": "string",
              "pattern": "^https?://[^\\s{}]+$",
              "description": "Downloadable HTTP(S) image URL, without credentials. No data:, blob: or local paths."
            }
          },
          "character_weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "omni_reference": {
            "type": "string",
            "pattern": "^https?://[^\\s{}]+$",
            "description": "Downloadable HTTP(S) image URL, without credentials. No data:, blob: or local paths."
          },
          "omni_weight": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "profile_codes": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9]{2,32}$"
            },
            "description": "Explicit shared codes only, case-insensitively unique. No default/global/random. Generate only, not Niji; supports V7 standard Omni at the Omni price, but not style_weight/style_version."
          }
        },
        "allOf": [
          {
            "if": {
              "anyOf": [
                {
                  "not": {
                    "required": [
                      "operation"
                    ]
                  }
                },
                {
                  "properties": {
                    "operation": {
                      "enum": [
                        "generate",
                        "edit",
                        "retexture",
                        "region",
                        "custom_zoom"
                      ]
                    }
                  },
                  "required": [
                    "operation"
                  ]
                }
              ]
            },
            "then": {
              "required": [
                "prompt"
              ],
              "properties": {
                "prompt": {
                  "minLength": 1,
                  "pattern": "\\S"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "operation"
              ],
              "properties": {
                "operation": {
                  "enum": [
                    "select",
                    "variation",
                    "reroll",
                    "upscale_subtle",
                    "upscale_creative",
                    "vary_subtle",
                    "vary_strong",
                    "zoom_1_5",
                    "zoom_2",
                    "pan_left",
                    "pan_right",
                    "pan_up",
                    "pan_down",
                    "custom_zoom",
                    "region"
                  ]
                }
              }
            },
            "then": {
              "required": [
                "parent_task_id",
                "output_index"
              ]
            },
            "else": {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "parent_task_id"
                    ]
                  },
                  {
                    "required": [
                      "output_index"
                    ]
                  }
                ]
              }
            }
          },
          {
            "if": {
              "not": {
                "required": [
                  "prompt"
                ],
                "properties": {
                  "prompt": {
                    "pattern": "(?:^https?://|(?:^|\\s)--\\S)"
                  }
                }
              }
            },
            "then": {
              "allOf": [
                {
                  "if": {
                    "required": [
                      "generation_mode"
                    ],
                    "properties": {
                      "generation_mode": {
                        "enum": [
                          "draft",
                          "hd"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v7",
                          "midjourney-v8.1",
                          "midjourney-v8.2"
                        ]
                      },
                      "operation": {
                        "const": "generate"
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "generation_mode"
                    ],
                    "properties": {
                      "generation_mode": {
                        "enum": [
                          "hd"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v8.1",
                          "midjourney-v8.2"
                        ]
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "select",
                          "variation",
                          "reroll",
                          "upscale_subtle",
                          "upscale_creative",
                          "vary_subtle",
                          "vary_strong",
                          "zoom_1_5",
                          "zoom_2",
                          "pan_left",
                          "pan_right",
                          "pan_up",
                          "pan_down",
                          "custom_zoom",
                          "region"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "images": {
                        "maxItems": 0
                      }
                    },
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "stylize"
                          ]
                        },
                        {
                          "required": [
                            "chaos"
                          ]
                        },
                        {
                          "required": [
                            "raw"
                          ]
                        },
                        {
                          "required": [
                            "seed"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "select",
                          "variation",
                          "reroll",
                          "upscale_subtle",
                          "upscale_creative",
                          "vary_subtle",
                          "vary_strong",
                          "zoom_1_5",
                          "zoom_2",
                          "pan_left",
                          "pan_right",
                          "pan_up",
                          "pan_down"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "prompt": {
                        "const": ""
                      },
                      "aspect_ratio": {
                        "const": ""
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "custom_zoom"
                        ]
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "zoom"
                    ]
                  },
                  "else": {
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "zoom"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "region"
                        ]
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "mask"
                    ]
                  },
                  "else": {
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "mask"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "edit"
                        ]
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "images"
                    ],
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v8.1",
                          "midjourney-v8.2"
                        ]
                      },
                      "images": {
                        "minItems": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "retexture"
                        ]
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "images"
                    ],
                    "properties": {
                      "model": {
                        "const": "midjourney-v6.1"
                      },
                      "images": {
                        "minItems": 1,
                        "maxItems": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "blend",
                          "describe"
                        ]
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "images"
                    ],
                    "properties": {
                      "prompt": {
                        "const": ""
                      },
                      "aspect_ratio": {
                        "const": "1:1"
                      }
                    },
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "stylize"
                          ]
                        },
                        {
                          "required": [
                            "chaos"
                          ]
                        },
                        {
                          "required": [
                            "raw"
                          ]
                        },
                        {
                          "required": [
                            "seed"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "blend"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "images": {
                        "minItems": 2
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "operation"
                    ],
                    "properties": {
                      "operation": {
                        "enum": [
                          "describe"
                        ]
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "images": {
                        "minItems": 1,
                        "maxItems": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "style_references"
                    ],
                    "properties": {
                      "style_references": {
                        "minItems": 1
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "operation": {
                        "type": "string",
                        "enum": [
                          "generate",
                          "edit"
                        ]
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "style_codes"
                    ],
                    "properties": {
                      "style_codes": {
                        "minItems": 1
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "operation": {
                        "type": "string",
                        "enum": [
                          "generate",
                          "edit"
                        ]
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "character_references"
                    ],
                    "properties": {
                      "character_references": {
                        "minItems": 1
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "operation": {
                        "type": "string",
                        "enum": [
                          "generate",
                          "edit"
                        ]
                      },
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v6",
                          "midjourney-v6.1",
                          "niji-v6"
                        ]
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "omni_reference"
                    ]
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "const": "midjourney-v7"
                      },
                      "operation": {
                        "const": "generate"
                      },
                      "generation_mode": {
                        "const": "standard"
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "character_weight"
                    ]
                  },
                  "then": {
                    "required": [
                      "character_references"
                    ],
                    "properties": {
                      "character_references": {
                        "minItems": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "omni_weight"
                    ]
                  },
                  "then": {
                    "required": [
                      "omni_reference"
                    ]
                  }
                },
                {
                  "if": {
                    "anyOf": [
                      {
                        "required": [
                          "style_weight"
                        ]
                      },
                      {
                        "required": [
                          "style_version"
                        ]
                      }
                    ]
                  },
                  "then": {
                    "anyOf": [
                      {
                        "required": [
                          "style_references"
                        ],
                        "properties": {
                          "style_references": {
                            "minItems": 1
                          }
                        }
                      },
                      {
                        "required": [
                          "style_codes"
                        ],
                        "properties": {
                          "style_codes": {
                            "minItems": 1
                          }
                        }
                      }
                    ]
                  }
                },
                {
                  "if": {
                    "required": [
                      "style_version"
                    ]
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v6",
                          "midjourney-v6.1",
                          "midjourney-v7"
                        ]
                      }
                    },
                    "allOf": [
                      {
                        "if": {
                          "required": [
                            "model"
                          ],
                          "properties": {
                            "model": {
                              "enum": [
                                "midjourney-v6",
                                "midjourney-v6.1"
                              ]
                            }
                          }
                        },
                        "then": {
                          "properties": {
                            "style_version": {
                              "maximum": 4
                            }
                          }
                        }
                      },
                      {
                        "if": {
                          "required": [
                            "style_codes"
                          ],
                          "properties": {
                            "model": {
                              "const": "midjourney-v7"
                            },
                            "style_codes": {
                              "minItems": 1
                            }
                          }
                        },
                        "then": {
                          "properties": {
                            "style_version": {
                              "enum": [
                                4,
                                6
                              ]
                            }
                          }
                        }
                      }
                    ]
                  }
                },
                {
                  "if": {
                    "required": [
                      "profile_codes"
                    ],
                    "properties": {
                      "profile_codes": {
                        "minItems": 1
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v6",
                          "midjourney-v6.1",
                          "midjourney-v7",
                          "midjourney-v8.1",
                          "midjourney-v8.2"
                        ]
                      },
                      "operation": {
                        "const": "generate"
                      }
                    },
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "style_weight"
                          ]
                        },
                        {
                          "required": [
                            "style_version"
                          ]
                        }
                      ]
                    }
                  }
                },
                {
                  "if": {
                    "anyOf": [
                      {
                        "required": [
                          "negative_prompt"
                        ]
                      },
                      {
                        "required": [
                          "image_weight"
                        ]
                      },
                      {
                        "required": [
                          "tile"
                        ]
                      },
                      {
                        "required": [
                          "weird"
                        ]
                      }
                    ]
                  },
                  "then": {
                    "properties": {
                      "operation": {
                        "const": "generate"
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "image_weight"
                    ]
                  },
                  "then": {
                    "required": [
                      "images"
                    ],
                    "properties": {
                      "images": {
                        "minItems": 1
                      }
                    },
                    "allOf": [
                      {
                        "if": {
                          "required": [
                            "model"
                          ],
                          "properties": {
                            "model": {
                              "enum": [
                                "niji-v7"
                              ]
                            }
                          }
                        },
                        "then": {
                          "properties": {
                            "image_weight": {
                              "maximum": 2
                            }
                          }
                        }
                      }
                    ]
                  }
                },
                {
                  "if": {
                    "required": [
                      "weird"
                    ]
                  },
                  "then": {
                    "properties": {
                      "model": {
                        "type": "string",
                        "enum": [
                          "midjourney-v6",
                          "midjourney-v6.1",
                          "midjourney-v7",
                          "midjourney-v8.1",
                          "midjourney-v8.2"
                        ]
                      }
                    }
                  }
                }
              ]
            }
          }
        ]
      },
      "MidjourneyVideo": {
        "type": "object",
        "required": [
          "model"
        ],
        "additionalProperties": false,
        "description": "Image-to-video, approximately 5s, or extend by approximately 4s up to four times. No arbitrary duration. Extend requires an owned completed video task, valid original output index and matching parent resolution.",
        "properties": {
          "speed": {
            "type": "string",
            "enum": [
              "fast",
              "relax"
            ],
            "description": "Explicit speed recommended. Omitted follow-up speed inherits the parent when available; otherwise the route default applies."
          },
          "max_cost_usd": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000,
            "description": "Submission price ceiling in USD. A higher quote is rejected with HTTP 409."
          },
          "model": {
            "type": "string",
            "const": "midjourney-video"
          },
          "prompt": {
            "type": "string",
            "maxLength": 4000,
            "pattern": "^(?![\\s\\S]*--)[^{}]*$"
          },
          "operation": {
            "type": "string",
            "enum": [
              "generate",
              "extend"
            ],
            "default": "generate"
          },
          "images": {
            "type": "array",
            "minItems": 0,
            "maxItems": 2,
            "items": {
              "type": "string",
              "pattern": "^https?://[^\\s{}]+$",
              "description": "Downloadable HTTP(S) image URL, without credentials. No data:, blob: or local paths."
            }
          },
          "parent_task_id": {
            "type": "string",
            "pattern": "^task_",
            "maxLength": 128
          },
          "output_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ],
            "default": "480p"
          },
          "motion": {
            "type": "string",
            "enum": [
              "low",
              "high"
            ],
            "default": "low"
          },
          "n": {
            "type": "integer",
            "enum": [
              1,
              2,
              4
            ],
            "default": 1
          },
          "raw": {
            "type": "boolean"
          },
          "loop": {
            "type": "boolean"
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "operation"
              ],
              "properties": {
                "operation": {
                  "enum": [
                    "extend"
                  ]
                }
              }
            },
            "then": {
              "required": [
                "parent_task_id",
                "output_index"
              ],
              "properties": {
                "images": {
                  "maxItems": 0
                },
                "loop": {
                  "const": false
                }
              }
            },
            "else": {
              "required": [
                "images"
              ],
              "properties": {
                "images": {
                  "minItems": 1
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "parent_task_id"
                    ]
                  },
                  {
                    "required": [
                      "output_index"
                    ]
                  }
                ]
              }
            }
          },
          {
            "if": {
              "required": [
                "resolution"
              ],
              "properties": {
                "resolution": {
                  "enum": [
                    "720p"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "speed": {
                  "const": "fast"
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "loop"
              ],
              "properties": {
                "loop": {
                  "enum": [
                    true
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "images": {
                  "maxItems": 1
                }
              }
            }
          }
        ]
      },
      "MidjourneyEstimate": {
        "type": "object",
        "required": [
          "quota",
          "estimated_cost_usd"
        ],
        "additionalProperties": true,
        "properties": {
          "quota": {
            "type": "integer",
            "minimum": 0
          },
          "estimated_cost_usd": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "Seedance20": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty generation or editing instruction."
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "text_to_video",
              "first_last_frame",
              "multi_ref"
            ],
            "description": "Omit for Seedance text generation. Use explicit frame/reference modes when providing images."
          },
          "audio": {
            "type": "boolean",
            "description": "Generate audio in the output; independent of reference_audio_urls."
          },
          "first_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "last_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "model": {
            "type": "string",
            "enum": [
              "dreamina-seedance-2-0-ep",
              "doubao-seedance-2-0-260128"
            ]
          },
          "duration": {
            "type": "integer",
            "minimum": 4,
            "maximum": 15
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p",
              "4k"
            ]
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4",
              "21:9",
              "adaptive"
            ],
            "description": "Frame generation follows the frame image. Prefer adaptive for frame mode."
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 9
          },
          "reference_video_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 3
          },
          "reference_audio_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 3
          },
          "metadata": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reference_video_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 15.2,
                "description": "Optional compatibility field. Server measures reference videos and uses the verified total for validation and prebilling."
              },
              "reference_audio_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 15.2,
                "description": "Optional compatibility field. Server measures reference audio separately from video."
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "mode": {
                  "const": "first_last_frame"
                }
              },
              "required": [
                "mode"
              ]
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "first_frame_url"
                  ]
                },
                {
                  "required": [
                    "last_frame_url"
                  ]
                }
              ],
              "properties": {
                "image_urls": {
                  "maxItems": 0
                },
                "reference_video_urls": {
                  "maxItems": 0
                },
                "reference_audio_urls": {
                  "maxItems": 0
                }
              }
            }
          }
        ]
      },
      "Seedance20FastMini": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty generation or editing instruction."
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "text_to_video",
              "first_last_frame",
              "multi_ref"
            ],
            "description": "Omit for Seedance text generation. Use explicit frame/reference modes when providing images."
          },
          "audio": {
            "type": "boolean",
            "description": "Generate audio in the output; independent of reference_audio_urls."
          },
          "first_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "last_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "model": {
            "type": "string",
            "enum": [
              "dreamina-seedance-2-0-fast-ep",
              "dreamina-seedance-2-0-mini-ep",
              "doubao-seedance-2-0-fast-260128",
              "doubao-seedance-2-0-mini-260615"
            ]
          },
          "duration": {
            "type": "integer",
            "minimum": 4,
            "maximum": 15
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4",
              "21:9",
              "adaptive"
            ],
            "description": "Frame generation follows the frame image. Prefer adaptive for frame mode."
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 9
          },
          "reference_video_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 3
          },
          "reference_audio_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 3
          },
          "metadata": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reference_video_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 15.2,
                "description": "Optional compatibility field. Server measures reference videos and uses the verified total for validation and prebilling."
              },
              "reference_audio_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 15.2,
                "description": "Optional compatibility field. Server measures reference audio separately from video."
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "mode": {
                  "const": "first_last_frame"
                }
              },
              "required": [
                "mode"
              ]
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "first_frame_url"
                  ]
                },
                {
                  "required": [
                    "last_frame_url"
                  ]
                }
              ],
              "properties": {
                "image_urls": {
                  "maxItems": 0
                },
                "reference_video_urls": {
                  "maxItems": 0
                },
                "reference_audio_urls": {
                  "maxItems": 0
                }
              }
            }
          }
        ]
      },
      "Seedance25": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty generation or editing instruction."
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "text_to_video",
              "first_last_frame",
              "multi_ref"
            ],
            "description": "Omit for Seedance text generation. Use explicit frame/reference modes when providing images."
          },
          "audio": {
            "type": "boolean",
            "description": "Generate audio in the output; independent of reference_audio_urls."
          },
          "first_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "last_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "model": {
            "type": "string",
            "enum": [
              "dreamina-seedance-2-5-ep",
              "doubao-seedance-2-5-260628"
            ]
          },
          "duration": {
            "type": "integer",
            "oneOf": [
              {
                "minimum": 4,
                "maximum": 30
              },
              {
                "const": -1
              }
            ],
            "description": "-1 means automatic output duration (not necessarily editing). Edit requires -1; extend also accepts 4-30. Automatic output is estimated at 30s unless an explicit edit has known input duration; final billing uses actual usage."
          },
          "omni_reference_task_type": {
            "type": "string",
            "enum": [
              "auto",
              "reference",
              "edit",
              "extend"
            ],
            "description": "Optional intent validation hint for multi_ref. Does not override prompt interpretation; mismatches may fail with TaskTypeMismatch. Edit and extend require at least one video and adaptive aspect; mixed image/video/audio references remain supported.",
            "default": "auto"
          },
          "draft": {
            "type": "boolean",
            "default": false,
            "description": "480p draft on an explicitly supported route. Later 1080p generation is billed independently."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4",
              "21:9",
              "adaptive"
            ],
            "description": "Frame generation follows the frame image. Prefer adaptive for frame mode."
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 30
          },
          "reference_video_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 10
          },
          "reference_audio_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 10
          },
          "metadata": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reference_video_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 30.2,
                "description": "Optional compatibility field. Server measures reference videos and uses the verified total for validation and prebilling."
              },
              "reference_audio_seconds": {
                "type": "number",
                "minimum": 1.8,
                "maximum": 30.2,
                "description": "Optional compatibility field. Server measures reference audio separately from video."
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "mode": {
                  "const": "first_last_frame"
                }
              },
              "required": [
                "mode"
              ]
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "first_frame_url"
                  ]
                },
                {
                  "required": [
                    "last_frame_url"
                  ]
                }
              ],
              "properties": {
                "image_urls": {
                  "maxItems": 0
                },
                "reference_video_urls": {
                  "maxItems": 0
                },
                "reference_audio_urls": {
                  "maxItems": 0
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "draft": {
                  "const": true
                }
              },
              "required": [
                "draft"
              ]
            },
            "then": {
              "required": [
                "resolution"
              ],
              "properties": {
                "resolution": {
                  "const": "480p"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "omni_reference_task_type": {
                  "enum": [
                    "edit",
                    "extend"
                  ]
                }
              },
              "required": [
                "omni_reference_task_type"
              ]
            },
            "then": {
              "required": [
                "reference_video_urls",
                "aspect_ratio"
              ],
              "properties": {
                "aspect_ratio": {
                  "const": "adaptive"
                },
                "reference_video_urls": {
                  "minItems": 1
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "first_frame_url"
                    ]
                  },
                  {
                    "required": [
                      "last_frame_url"
                    ]
                  }
                ]
              }
            }
          },
          {
            "if": {
              "properties": {
                "omni_reference_task_type": {
                  "const": "edit"
                }
              },
              "required": [
                "omni_reference_task_type"
              ]
            },
            "then": {
              "required": [
                "duration"
              ],
              "properties": {
                "duration": {
                  "const": -1
                },
                "metadata": {
                  "properties": {
                    "reference_video_seconds": {
                      "minimum": 4
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Seedance25Final": {
        "type": "object",
        "required": [
          "model",
          "draft_task_id",
          "resolution"
        ],
        "additionalProperties": false,
        "description": "Generate a separately billed 1080p result from an owned, completed, unexpired draft on the same model and original credential. Omit prompt, duration, audio, ratio, references and metadata.",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "dreamina-seedance-2-5-ep",
              "doubao-seedance-2-5-260628"
            ]
          },
          "draft_task_id": {
            "type": "string",
            "pattern": "^task_.+",
            "description": "Platform draft task ID, not a provider ID or video URL."
          },
          "resolution": {
            "type": "string",
            "const": "1080p"
          },
          "draft": {
            "type": "boolean",
            "const": false
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "group": {
            "type": "string",
            "minLength": 1,
            "description": "An authorized billing group."
          },
          "max_cost_usd": {
            "type": "number",
            "minimum": 0,
            "description": "Optional pre-consumption quote ceiling in USD. A higher hold returns 409 approval_price_changed before charging; actual usage settlement is not capped."
          }
        }
      },
      "Wan3": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "description": "Video/audio clips are each 1-15 seconds; sums are separately <=15s. Input video seconds + output seconds <=30. Media are inspected server-side.",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty generation or editing instruction."
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "text_to_video",
              "first_last_frame",
              "multi_ref"
            ],
            "description": "Omit for Seedance text generation. Use explicit frame/reference modes when providing images."
          },
          "audio": {
            "type": "boolean",
            "description": "Generate audio in the output; independent of reference_audio_urls."
          },
          "first_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "last_frame_url": {
            "type": "string",
            "minLength": 1,
            "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
          },
          "model": {
            "const": "wan3.0-video-ep",
            "type": "string"
          },
          "duration": {
            "type": "integer",
            "minimum": 2,
            "maximum": 30,
            "default": 5
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 10
          },
          "reference_video_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 5
          },
          "reference_audio_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 5
          },
          "prompt_extend": {
            "type": "boolean",
            "description": "Prompt expansion. Pass explicitly to select behavior."
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "mode": {
                  "const": "first_last_frame"
                }
              },
              "required": [
                "mode"
              ]
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "first_frame_url"
                  ]
                },
                {
                  "required": [
                    "last_frame_url"
                  ]
                }
              ],
              "properties": {
                "image_urls": {
                  "maxItems": 0
                },
                "reference_video_urls": {
                  "maxItems": 0
                },
                "reference_audio_urls": {
                  "maxItems": 0
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "reference_audio_urls": {
                  "minItems": 1
                }
              },
              "required": [
                "reference_audio_urls"
              ]
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "image_urls"
                  ],
                  "properties": {
                    "image_urls": {
                      "minItems": 1
                    }
                  }
                },
                {
                  "required": [
                    "reference_video_urls"
                  ],
                  "properties": {
                    "reference_video_urls": {
                      "minItems": 1
                    }
                  }
                }
              ]
            }
          }
        ]
      },
      "Seedream": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "dola-seedream-5-0-pro-ep"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty image prompt or edit instruction."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 10
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 10
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "2:3",
              "3:2",
              "3:4",
              "4:3",
              "9:16",
              "16:9",
              "21:9"
            ]
          },
          "resolution": {
            "type": "string",
            "enum": [
              "1k",
              "2k"
            ]
          },
          "output_format": {
            "type": "string",
            "enum": [
              "jpeg",
              "png"
            ]
          }
        },
        "description": "default-group contract. Nonempty images select edit automatically; do not append -edit to the model. One image per task.",
        "allOf": [
          {
            "not": {
              "required": [
                "images",
                "image_urls"
              ]
            }
          }
        ]
      },
      "GPTImage2": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "gpt-image-2"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty image prompt or edit instruction."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 16
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 16
          },
          "aspect_ratio": {
            "type": "string",
            "minLength": 1,
            "description": "WIDTH:HEIGHT, within 1:3-3:1. Omit for automatic reference sizing. Omit when using custom size."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "auto",
              "1k",
              "2k",
              "4k",
              "custom"
            ]
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg",
              "webp"
            ]
          },
          "n": {
            "type": "integer",
            "const": 1,
            "default": 1
          },
          "size": {
            "type": "string",
            "pattern": "^(auto|[0-9]+x[0-9]+)$",
            "description": "Multiples of 16; longest side <=3840; ratio <=3; pixels 655360-8294400. Or auto."
          },
          "quality": {
            "type": "string",
            "enum": [
              "auto",
              "low",
              "medium",
              "high"
            ]
          },
          "moderation": {
            "type": "string",
            "enum": [
              "auto",
              "low"
            ]
          }
        },
        "description": "default-group contract. Nonempty images select edit automatically; do not append -edit to the model. One image per task.",
        "allOf": [
          {
            "not": {
              "required": [
                "images",
                "image_urls"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "resolution": {
                  "const": "custom"
                }
              },
              "required": [
                "resolution"
              ]
            },
            "then": {
              "required": [
                "size"
              ],
              "properties": {
                "size": {
                  "pattern": "^[0-9]+x[0-9]+$"
                }
              }
            }
          }
        ]
      },
      "Banana": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "nano-banana-2",
              "nano-banana-pro"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Non-empty image prompt or edit instruction."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 14
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "Public HTTP(S) file URL. Supported image fields also accept image Data URLs. Do not use blob: or local paths."
            },
            "maxItems": 14
          },
          "aspect_ratio": {
            "type": "string",
            "minLength": 1,
            "description": "WIDTH:HEIGHT, within 1:3-3:1. Omit for automatic reference sizing. Omit when using custom size."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "1k",
              "2k",
              "custom"
            ]
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg",
              "webp"
            ]
          },
          "n": {
            "type": "integer",
            "const": 1,
            "default": 1
          },
          "size": {
            "type": "string",
            "pattern": "^[0-9]+x[0-9]+$",
            "description": "Multiples of 16; sides 256-3168; ratio <=3; pixels <=4300000."
          }
        },
        "description": "default-group contract. Nonempty images select edit automatically; do not append -edit to the model. One image per task.",
        "allOf": [
          {
            "not": {
              "required": [
                "images",
                "image_urls"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "resolution": {
                  "const": "custom"
                }
              },
              "required": [
                "resolution"
              ]
            },
            "then": {
              "required": [
                "size"
              ],
              "properties": {
                "size": {
                  "pattern": "^[0-9]+x[0-9]+$"
                }
              }
            }
          }
        ]
      },
      "TaskError": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "number"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "MidjourneyResultTransferStatus": {
        "type": "string",
        "enum": [
          "queued",
          "pending",
          "stored",
          "failed"
        ],
        "description": "Optional Midjourney result persistence status, independent of generation status. completed may precede stored. Poll for stored when a platform-hosted URL is required; failed here does not mean generation failed. Older responses may omit this field."
      },
      "Usage": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "estimated_cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "actual_cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "quota": {
            "type": "integer",
            "description": "Internal units, not USD. Prefer cost_usd fields."
          },
          "billing_mode": {
            "type": "string"
          },
          "price_unit": {
            "type": "string"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "billing_detail": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "TaskOutput": {
        "type": "object",
        "required": [
          "url"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable output ID such as output_1; do not renumber filtered results."
          },
          "object": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Midjourney may initially return an official CDN URL, later replaced by a platform-hosted URL after persistence. The output ID remains stable."
          },
          "mime_type": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          }
        }
      },
      "VideoTask": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "Persist this public task ID immediately."
          },
          "model": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed",
              "unknown"
            ]
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "created_at": {
            "type": "integer",
            "description": "Unix timestamp in seconds."
          },
          "completed_at": {
            "type": "integer"
          },
          "error": {
            "$ref": "#/components/schemas/TaskError"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "object": {
            "type": "string",
            "const": "video"
          },
          "task_id": {
            "type": "string"
          },
          "outputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskOutput"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "First video for compatibility. Use outputs for all videos."
              },
              "result_transfer_status": {
                "$ref": "#/components/schemas/MidjourneyResultTransferStatus"
              },
              "draft": {
                "type": "boolean"
              },
              "draft_can_finalize": {
                "type": "boolean",
                "description": "Draft completed and reusable before expiry; final submission also checks current access and credential availability."
              },
              "draft_expires_at": {
                "type": "integer",
                "description": "Unix seconds. Expiry disables final generation but does not delete the saved video."
              },
              "draft_task_id": {
                "type": "string",
                "description": "Original platform draft ID on a final-generation result."
              }
            }
          }
        }
      },
      "ImageTask": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "Persist this public task ID immediately."
          },
          "model": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed",
              "unknown"
            ]
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "created_at": {
            "type": "integer",
            "description": "Unix timestamp in seconds."
          },
          "completed_at": {
            "type": "integer"
          },
          "error": {
            "$ref": "#/components/schemas/TaskError"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "object": {
            "const": "image.generation.task",
            "type": "string"
          },
          "operation": {
            "type": "string",
            "description": "Actual operation, including Midjourney follow-up operations."
          },
          "started_at": {
            "type": "integer"
          },
          "outputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskOutput"
            }
          },
          "result_transfer_status": {
            "$ref": "#/components/schemas/MidjourneyResultTransferStatus"
          },
          "descriptions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Midjourney describe candidates. A successful describe task need not have image outputs."
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "operation",
                "output_index"
              ],
              "properties": {
                "operation": {
                  "type": "string"
                },
                "output_index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 23
                }
              }
            },
            "description": "Available Midjourney actions. Submit these exact operation/index pairs with parent_task_id and the original image model."
          }
        }
      },
      "MediaFile": {
        "type": "object",
        "required": [
          "id",
          "file_id",
          "url",
          "status"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "integer"
          },
          "file_id": {
            "type": "integer",
            "description": "Local file record ID, not an upstream asset ID."
          },
          "object": {
            "type": "string",
            "const": "file"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "status": {
            "type": "string"
          },
          "media_type": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer",
            "description": "Unix seconds; omitted for permanent uploads. New tasks cannot use temporary uploads after expiry; existing tasks remain protected."
          }
        }
      },
      "NovelAICharacterPrompt": {
        "type": "object",
        "required": [
          "caption"
        ],
        "additionalProperties": true,
        "description": "For the listed text-to-image and ordinary img2img models, every supplied prompt must contain caption.char_captions. Use [] with no characters. Medium permits either entire prompt object to be omitted.",
        "properties": {
          "caption": {
            "type": "object",
            "required": [
              "char_captions"
            ],
            "additionalProperties": true,
            "properties": {
              "char_captions": {
                "type": "array",
                "items": {},
                "description": "Empty array is valid; null, an object or an omitted array is not."
              }
            }
          }
        }
      },
      "NovelAIGenerationParameters": {
        "type": "object",
        "required": [
          "width",
          "height",
          "steps"
        ],
        "additionalProperties": true,
        "description": "Official parameters are preserved. Pixels <=3145728; ordinary img2img submissions require positive width/height multiples of 64. The platform does not resize the source automatically. Max Enhance and inpainting retain their own dimension rules. V5 does not support Vibe, Precise Reference, Variety+ or CFG Delay.",
        "properties": {
          "width": {
            "type": "integer",
            "minimum": 1
          },
          "height": {
            "type": "integer",
            "minimum": 1
          },
          "steps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 50
          },
          "n_samples": {
            "type": "integer",
            "const": 1,
            "default": 1,
            "description": "Omitted is accounted as one sample; raw native/task payloads are not modified to insert it. Explicit values other than 1 are rejected."
          },
          "params_version": {
            "type": "integer",
            "description": "4 for V5; 3 in V3/V4/V4.5 examples."
          },
          "scale": {
            "type": "number"
          },
          "seed": {
            "type": "integer",
            "minimum": 0
          },
          "sampler": {
            "type": "string"
          },
          "noise_schedule": {
            "type": "string"
          },
          "uc": {
            "type": "string"
          },
          "image_format": {
            "type": "string",
            "enum": [
              "png",
              "webp"
            ],
            "description": "Streaming defaults to png; explicit webp preserves original format."
          },
          "stream": {
            "type": "string",
            "const": "msgpack",
            "description": "Selects streaming transport in task requests; cannot combine with outer stream:false. Native synchronous generate-image and request-price endpoints ignore this exact hint for client compatibility and keep ZIP/JSON responses."
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
          },
          "mask": {
            "type": "string",
            "minLength": 1,
            "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
          },
          "strength": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "noise": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "upscaled_enhance": {
            "type": "boolean",
            "description": "V5 img2img Max Enhance. Keep input width/height; output is up to 2x, capped at 3145728 pixels. Pricing uses output dimensions."
          },
          "v4_prompt": {
            "type": "object",
            "additionalProperties": true
          },
          "v4_negative_prompt": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "NovelAIGenerationPayload": {
        "type": "object",
        "required": [
          "model",
          "action",
          "parameters"
        ],
        "additionalProperties": true,
        "properties": {
          "input": {
            "type": "string",
            "description": "Recommended to match v4_prompt.caption.base_caption. V5 text-to-image can use the structured caption without input."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "generate",
              "img2img",
              "infill"
            ]
          },
          "parameters": {
            "$ref": "#/components/schemas/NovelAIGenerationParameters"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "image"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "infill"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "image",
                    "mask"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "allOf": [
                {
                  "anyOf": [
                    {
                      "properties": {
                        "action": {
                          "const": "generate"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    {
                      "properties": {
                        "action": {
                          "const": "img2img"
                        },
                        "parameters": {
                          "not": {
                            "properties": {
                              "upscaled_enhance": {
                                "const": true
                              }
                            },
                            "required": [
                              "upscaled_enhance"
                            ]
                          }
                        }
                      },
                      "required": [
                        "action"
                      ]
                    }
                  ]
                },
                {
                  "properties": {
                    "model": {
                      "enum": [
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-curated",
                        "nai-diffusion-4-5-full"
                      ]
                    }
                  },
                  "required": [
                    "model"
                  ]
                }
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "v4_prompt",
                    "v4_negative_prompt"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "allOf": [
                {
                  "anyOf": [
                    {
                      "properties": {
                        "action": {
                          "const": "generate"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    {
                      "properties": {
                        "action": {
                          "const": "img2img"
                        },
                        "parameters": {
                          "not": {
                            "properties": {
                              "upscaled_enhance": {
                                "const": true
                              }
                            },
                            "required": [
                              "upscaled_enhance"
                            ]
                          }
                        }
                      },
                      "required": [
                        "action"
                      ]
                    }
                  ]
                },
                {
                  "properties": {
                    "model": {
                      "enum": [
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-curated",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-5-full-medium"
                      ]
                    }
                  },
                  "required": [
                    "model"
                  ]
                }
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "properties": {
                    "v4_prompt": {
                      "$ref": "#/components/schemas/NovelAICharacterPrompt"
                    },
                    "v4_negative_prompt": {
                      "$ref": "#/components/schemas/NovelAICharacterPrompt"
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                },
                "parameters": {
                  "not": {
                    "properties": {
                      "upscaled_enhance": {
                        "const": true
                      }
                    },
                    "required": [
                      "upscaled_enhance"
                    ]
                  }
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "properties": {
                    "width": {
                      "type": "integer",
                      "minimum": 64,
                      "multipleOf": 64
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 64,
                      "multipleOf": 64
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "NovelAITaskRequest": {
        "type": "object",
        "required": [
          "model",
          "operation",
          "payload"
        ],
        "additionalProperties": false,
        "description": "Public platform-billed subset. Generation payload retains official parameters. Inpaint payload.model is the corresponding inpainting model; V5 Curated currently maps to V4.5 Curated inpainting.",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "operation": {
            "type": "string",
            "enum": [
              "generation",
              "director",
              "upscale",
              "encode-vibe"
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "payload": {
            "type": "object"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "generation"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "$ref": "#/components/schemas/NovelAIGenerationPayload"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "director"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "req_type",
                    "image",
                    "width",
                    "height"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "req_type": {
                      "type": "string",
                      "enum": [
                        "bg-removal",
                        "declutter",
                        "declutter-keep-bubbles",
                        "lineart",
                        "sketch",
                        "colorize",
                        "emotion"
                      ]
                    },
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "defry": {
                      "type": "integer"
                    },
                    "emotion": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "upscale"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "image"
                  ],
                  "additionalProperties": false,
                  "description": "Fixed 2x upscale, input pixels <=3145728. Base64 dimensions are detected automatically. Legacy dimensions may be supplied for estimates; submissions verify the source image.",
                  "properties": {
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "model": {
                      "type": "string",
                      "enum": [
                        "nai-diffusion-5-curated",
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-full-inpainting",
                        "nai-diffusion-5-full-medium",
                        "nai-diffusion-5-full-medium-inpainting",
                        "nai-diffusion-4-5-curated",
                        "nai-diffusion-4-5-curated-inpainting",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-4-5-full-inpainting",
                        "nai-diffusion-4-curated-preview",
                        "nai-diffusion-4-curated-inpainting",
                        "nai-diffusion-4-full",
                        "nai-diffusion-4-full-inpainting",
                        "nai-diffusion-3",
                        "nai-diffusion-3-inpainting",
                        "nai-diffusion-furry-3",
                        "nai-diffusion-furry-3-inpainting"
                      ],
                      "default": "nai-diffusion-5-curated"
                    },
                    "declared_blur_sigma": {
                      "type": "number",
                      "minimum": 0,
                      "default": 0
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "scale": {
                      "type": "integer",
                      "enum": [
                        2
                      ]
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "encode-vibe"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "image",
                    "model"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "model": {
                      "type": "string",
                      "enum": [
                        "nai-diffusion-4-5-curated",
                        "nai-diffusion-4-5-curated-inpainting",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-4-5-full-inpainting",
                        "nai-diffusion-4-curated-preview",
                        "nai-diffusion-4-curated-inpainting",
                        "nai-diffusion-4-full",
                        "nai-diffusion-4-full-inpainting"
                      ]
                    },
                    "information_extracted": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 1
                    },
                    "mask": {}
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "stream": {
                  "const": true
                }
              },
              "required": [
                "stream"
              ]
            },
            "then": {
              "properties": {
                "operation": {
                  "const": "generation"
                },
                "model": {
                  "enum": [
                    "nai-diffusion-5-curated",
                    "nai-diffusion-5-full",
                    "nai-diffusion-5-full-inpainting",
                    "nai-diffusion-5-full-medium",
                    "nai-diffusion-5-full-medium-inpainting",
                    "nai-diffusion-4-5-curated",
                    "nai-diffusion-4-5-curated-inpainting",
                    "nai-diffusion-4-5-full",
                    "nai-diffusion-4-5-full-inpainting",
                    "nai-diffusion-4-curated-preview",
                    "nai-diffusion-4-curated-inpainting",
                    "nai-diffusion-4-full",
                    "nai-diffusion-4-full-inpainting"
                  ]
                }
              }
            }
          }
        ]
      },
      "NovelAINativeRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/NovelAINativeGeneration"
          },
          {
            "properties": {
              "model": {
                "enum": [
                  "nai-diffusion-5-curated",
                  "nai-diffusion-5-full",
                  "nai-diffusion-5-full-inpainting",
                  "nai-diffusion-5-full-medium",
                  "nai-diffusion-5-full-medium-inpainting",
                  "nai-diffusion-4-5-curated",
                  "nai-diffusion-4-5-curated-inpainting",
                  "nai-diffusion-4-5-full",
                  "nai-diffusion-4-5-full-inpainting",
                  "nai-diffusion-4-curated-preview",
                  "nai-diffusion-4-curated-inpainting",
                  "nai-diffusion-4-full",
                  "nai-diffusion-4-full-inpainting"
                ]
              }
            }
          }
        ],
        "description": "Official streaming generation JSON without the task wrapper. One image per request; omit n_samples or set it to 1. Reference cache keys are scoped to the platform user."
      },
      "NovelAIUsage": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "pricing_version": {
            "type": "string"
          },
          "estimated_anlas": {
            "type": "integer",
            "minimum": 0
          },
          "actual_anlas": {
            "type": "integer",
            "minimum": 0
          },
          "estimated_cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "actual_cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "settlement_reliable": {
            "type": "boolean"
          },
          "settlement_reason": {
            "type": "string"
          }
        }
      },
      "NovelAITask": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "model",
          "operation"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "novelai.image.task"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed",
              "unknown"
            ]
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "model": {
            "type": "string"
          },
          "operation": {
            "type": "string",
            "enum": [
              "generation",
              "director",
              "upscale",
              "encode-vibe"
            ]
          },
          "created_at": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "updated_at": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "started_at": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "completed_at": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "usage": {
            "$ref": "#/components/schemas/NovelAIUsage"
          },
          "error": {
            "$ref": "#/components/schemas/TaskError"
          },
          "result": {
            "type": "object",
            "properties": {
              "encoded_vibe": {
                "type": "string",
                "description": "Base64-encoded Vibe vector, not an image."
              },
              "images": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "url",
                    "filename",
                    "mime_type",
                    "size"
                  ],
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "mime_type": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "md5": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "NovelAIEstimate": {
        "type": "object",
        "required": [
          "object",
          "model",
          "operation",
          "estimate",
          "usage"
        ],
        "properties": {
          "object": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "estimate": {
            "type": "object",
            "additionalProperties": true
          },
          "usage": {
            "$ref": "#/components/schemas/NovelAIUsage"
          }
        }
      },
      "NovelAINativeGeneration": {
        "type": "object",
        "required": [
          "model",
          "action",
          "parameters"
        ],
        "additionalProperties": true,
        "properties": {
          "input": {
            "type": "string",
            "description": "Recommended to match v4_prompt.caption.base_caption. V5 text-to-image can use the structured caption without input."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "generate",
              "img2img",
              "infill"
            ]
          },
          "parameters": {
            "type": "object",
            "required": [
              "width",
              "height",
              "steps"
            ],
            "additionalProperties": true,
            "description": "Official parameters are preserved. Pixels <=3145728; ordinary img2img submissions require positive width/height multiples of 64. The platform does not resize the source automatically. Max Enhance and inpainting retain their own dimension rules. V5 does not support Vibe, Precise Reference, Variety+ or CFG Delay.",
            "properties": {
              "width": {
                "type": "integer",
                "minimum": 1
              },
              "height": {
                "type": "integer",
                "minimum": 1
              },
              "steps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 50
              },
              "n_samples": {
                "type": "integer",
                "const": 1,
                "default": 1,
                "description": "One image per request. Other values return HTTP 400 before generation or billing."
              },
              "params_version": {
                "type": "integer",
                "description": "4 for V5; 3 in V3/V4/V4.5 examples."
              },
              "scale": {
                "type": "number"
              },
              "seed": {
                "type": "integer",
                "minimum": 0
              },
              "sampler": {
                "type": "string"
              },
              "noise_schedule": {
                "type": "string"
              },
              "uc": {
                "type": "string"
              },
              "image_format": {
                "type": "string",
                "enum": [
                  "png",
                  "webp"
                ],
                "description": "Streaming defaults to png; explicit webp preserves original format."
              },
              "stream": {
                "type": "string",
                "const": "msgpack",
                "description": "Selects streaming transport in task requests; cannot combine with outer stream:false. Native synchronous generate-image and request-price endpoints ignore this exact hint for client compatibility and keep ZIP/JSON responses."
              },
              "image": {
                "type": "string",
                "minLength": 1,
                "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
              },
              "mask": {
                "type": "string",
                "minLength": 1,
                "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
              },
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "upscaled_enhance": {
                "type": "boolean",
                "description": "V5 img2img Max Enhance. Keep input width/height; output is up to 2x, capped at 3145728 pixels. Pricing uses output dimensions."
              },
              "v4_prompt": {
                "type": "object",
                "additionalProperties": true
              },
              "v4_negative_prompt": {
                "type": "object",
                "additionalProperties": true
              },
              "image_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "mask_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "reference_image_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "reference_image_multiple_cached": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "cache_secret_key": {
                      "type": "string",
                      "maxLength": 256
                    }
                  },
                  "anyOf": [
                    {
                      "required": [
                        "data"
                      ]
                    },
                    {
                      "required": [
                        "cache_secret_key"
                      ]
                    }
                  ]
                }
              },
              "director_reference_images_cached": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "cache_secret_key": {
                      "type": "string",
                      "maxLength": 256
                    }
                  },
                  "anyOf": [
                    {
                      "required": [
                        "data"
                      ]
                    },
                    {
                      "required": [
                        "cache_secret_key"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "allOf": [
                    {
                      "anyOf": [
                        {
                          "required": [
                            "image"
                          ]
                        },
                        {
                          "required": [
                            "image_cache_secret_key"
                          ]
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "infill"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "allOf": [
                    {
                      "anyOf": [
                        {
                          "required": [
                            "image"
                          ]
                        },
                        {
                          "required": [
                            "image_cache_secret_key"
                          ]
                        }
                      ]
                    },
                    {
                      "anyOf": [
                        {
                          "required": [
                            "mask"
                          ]
                        },
                        {
                          "required": [
                            "mask_cache_secret_key"
                          ]
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          {
            "if": {
              "allOf": [
                {
                  "anyOf": [
                    {
                      "properties": {
                        "action": {
                          "const": "generate"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    {
                      "properties": {
                        "action": {
                          "const": "img2img"
                        },
                        "parameters": {
                          "not": {
                            "properties": {
                              "upscaled_enhance": {
                                "const": true
                              }
                            },
                            "required": [
                              "upscaled_enhance"
                            ]
                          }
                        }
                      },
                      "required": [
                        "action"
                      ]
                    }
                  ]
                },
                {
                  "properties": {
                    "model": {
                      "enum": [
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-curated",
                        "nai-diffusion-4-5-full"
                      ]
                    }
                  },
                  "required": [
                    "model"
                  ]
                }
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "v4_prompt",
                    "v4_negative_prompt"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "allOf": [
                {
                  "anyOf": [
                    {
                      "properties": {
                        "action": {
                          "const": "generate"
                        }
                      },
                      "required": [
                        "action"
                      ]
                    },
                    {
                      "properties": {
                        "action": {
                          "const": "img2img"
                        },
                        "parameters": {
                          "not": {
                            "properties": {
                              "upscaled_enhance": {
                                "const": true
                              }
                            },
                            "required": [
                              "upscaled_enhance"
                            ]
                          }
                        }
                      },
                      "required": [
                        "action"
                      ]
                    }
                  ]
                },
                {
                  "properties": {
                    "model": {
                      "enum": [
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-curated",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-5-full-medium"
                      ]
                    }
                  },
                  "required": [
                    "model"
                  ]
                }
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "properties": {
                    "v4_prompt": {
                      "$ref": "#/components/schemas/NovelAICharacterPrompt"
                    },
                    "v4_negative_prompt": {
                      "$ref": "#/components/schemas/NovelAICharacterPrompt"
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                },
                "parameters": {
                  "not": {
                    "properties": {
                      "upscaled_enhance": {
                        "const": true
                      }
                    },
                    "required": [
                      "upscaled_enhance"
                    ]
                  }
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "properties": {
                    "width": {
                      "type": "integer",
                      "minimum": 64,
                      "multipleOf": 64
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 64,
                      "multipleOf": 64
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "NovelAIPricingPayload": {
        "type": "object",
        "required": [
          "model",
          "action",
          "parameters"
        ],
        "additionalProperties": true,
        "properties": {
          "input": {
            "type": "string",
            "description": "Recommended to match v4_prompt.caption.base_caption. V5 text-to-image can use the structured caption without input."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "generate",
              "img2img",
              "infill"
            ]
          },
          "parameters": {
            "$ref": "#/components/schemas/NovelAIGenerationParameters"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "image"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "infill"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "required": [
                    "image",
                    "mask"
                  ]
                }
              }
            }
          }
        ]
      },
      "NovelAINativePricingRequest": {
        "type": "object",
        "required": [
          "model",
          "action",
          "parameters"
        ],
        "additionalProperties": true,
        "properties": {
          "input": {
            "type": "string",
            "description": "Recommended to match v4_prompt.caption.base_caption. V5 text-to-image can use the structured caption without input."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "generate",
              "img2img",
              "infill"
            ]
          },
          "parameters": {
            "type": "object",
            "required": [
              "width",
              "height",
              "steps"
            ],
            "additionalProperties": true,
            "description": "Official parameters are preserved. Pixels <=3145728; ordinary img2img submissions require positive width/height multiples of 64. The platform does not resize the source automatically. Max Enhance and inpainting retain their own dimension rules. V5 does not support Vibe, Precise Reference, Variety+ or CFG Delay.",
            "properties": {
              "width": {
                "type": "integer",
                "minimum": 1
              },
              "height": {
                "type": "integer",
                "minimum": 1
              },
              "steps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 50
              },
              "n_samples": {
                "type": "integer",
                "const": 1,
                "default": 1,
                "description": "One image per request. Other values return HTTP 400 before generation or billing."
              },
              "params_version": {
                "type": "integer",
                "description": "4 for V5; 3 in V3/V4/V4.5 examples."
              },
              "scale": {
                "type": "number"
              },
              "seed": {
                "type": "integer",
                "minimum": 0
              },
              "sampler": {
                "type": "string"
              },
              "noise_schedule": {
                "type": "string"
              },
              "uc": {
                "type": "string"
              },
              "image_format": {
                "type": "string",
                "enum": [
                  "png",
                  "webp"
                ],
                "description": "Streaming defaults to png; explicit webp preserves original format."
              },
              "stream": {
                "type": "string",
                "const": "msgpack",
                "description": "Selects streaming transport in task requests; cannot combine with outer stream:false. Native synchronous generate-image and request-price endpoints ignore this exact hint for client compatibility and keep ZIP/JSON responses."
              },
              "image": {
                "type": "string",
                "minLength": 1,
                "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
              },
              "mask": {
                "type": "string",
                "minLength": 1,
                "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
              },
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "upscaled_enhance": {
                "type": "boolean",
                "description": "V5 img2img Max Enhance. Keep input width/height; output is up to 2x, capped at 3145728 pixels. Pricing uses output dimensions."
              },
              "v4_prompt": {
                "type": "object",
                "additionalProperties": true
              },
              "v4_negative_prompt": {
                "type": "object",
                "additionalProperties": true
              },
              "image_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "mask_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "reference_image_cache_secret_key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "reference_image_multiple_cached": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "cache_secret_key": {
                      "type": "string",
                      "maxLength": 256
                    }
                  },
                  "anyOf": [
                    {
                      "required": [
                        "data"
                      ]
                    },
                    {
                      "required": [
                        "cache_secret_key"
                      ]
                    }
                  ]
                }
              },
              "director_reference_images_cached": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "cache_secret_key": {
                      "type": "string",
                      "maxLength": 256
                    }
                  },
                  "anyOf": [
                    {
                      "required": [
                        "data"
                      ]
                    },
                    {
                      "required": [
                        "cache_secret_key"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "img2img"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "allOf": [
                    {
                      "anyOf": [
                        {
                          "required": [
                            "image"
                          ]
                        },
                        {
                          "required": [
                            "image_cache_secret_key"
                          ]
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "infill"
                }
              },
              "required": [
                "action"
              ]
            },
            "then": {
              "properties": {
                "parameters": {
                  "allOf": [
                    {
                      "anyOf": [
                        {
                          "required": [
                            "image"
                          ]
                        },
                        {
                          "required": [
                            "image_cache_secret_key"
                          ]
                        }
                      ]
                    },
                    {
                      "anyOf": [
                        {
                          "required": [
                            "mask"
                          ]
                        },
                        {
                          "required": [
                            "mask_cache_secret_key"
                          ]
                        }
                      ]
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "NovelAITaskEstimateRequest": {
        "type": "object",
        "required": [
          "model",
          "operation",
          "payload"
        ],
        "additionalProperties": false,
        "description": "Pricing-only request. A successful quote does not validate the complete generation prompt.",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ]
          },
          "operation": {
            "type": "string",
            "enum": [
              "generation",
              "director",
              "upscale",
              "encode-vibe"
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "payload": {
            "type": "object"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "generation"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "$ref": "#/components/schemas/NovelAIPricingPayload"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "director"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "req_type",
                    "image",
                    "width",
                    "height"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "req_type": {
                      "type": "string",
                      "enum": [
                        "bg-removal",
                        "declutter",
                        "declutter-keep-bubbles",
                        "lineart",
                        "sketch",
                        "colorize",
                        "emotion"
                      ]
                    },
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "prompt": {
                      "type": "string"
                    },
                    "defry": {
                      "type": "integer"
                    },
                    "emotion": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "upscale"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "image"
                  ],
                  "additionalProperties": false,
                  "description": "Fixed 2x upscale, input pixels <=3145728. Base64 dimensions are detected automatically. Legacy dimensions may be supplied for estimates; submissions verify the source image.",
                  "properties": {
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "model": {
                      "type": "string",
                      "enum": [
                        "nai-diffusion-5-curated",
                        "nai-diffusion-5-full",
                        "nai-diffusion-5-full-inpainting",
                        "nai-diffusion-5-full-medium",
                        "nai-diffusion-5-full-medium-inpainting",
                        "nai-diffusion-4-5-curated",
                        "nai-diffusion-4-5-curated-inpainting",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-4-5-full-inpainting",
                        "nai-diffusion-4-curated-preview",
                        "nai-diffusion-4-curated-inpainting",
                        "nai-diffusion-4-full",
                        "nai-diffusion-4-full-inpainting",
                        "nai-diffusion-3",
                        "nai-diffusion-3-inpainting",
                        "nai-diffusion-furry-3",
                        "nai-diffusion-furry-3-inpainting"
                      ],
                      "default": "nai-diffusion-5-curated"
                    },
                    "declared_blur_sigma": {
                      "type": "number",
                      "minimum": 0,
                      "default": 0
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "scale": {
                      "type": "integer",
                      "enum": [
                        2
                      ]
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "encode-vibe"
                }
              }
            },
            "then": {
              "properties": {
                "payload": {
                  "type": "object",
                  "required": [
                    "image",
                    "model"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
                    },
                    "model": {
                      "type": "string",
                      "enum": [
                        "nai-diffusion-4-5-curated",
                        "nai-diffusion-4-5-curated-inpainting",
                        "nai-diffusion-4-5-full",
                        "nai-diffusion-4-5-full-inpainting",
                        "nai-diffusion-4-curated-preview",
                        "nai-diffusion-4-curated-inpainting",
                        "nai-diffusion-4-full",
                        "nai-diffusion-4-full-inpainting"
                      ]
                    },
                    "information_extracted": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 1
                    },
                    "mask": {}
                  }
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "stream": {
                  "const": true
                }
              },
              "required": [
                "stream"
              ]
            },
            "then": {
              "properties": {
                "operation": {
                  "const": "generation"
                },
                "model": {
                  "enum": [
                    "nai-diffusion-5-curated",
                    "nai-diffusion-5-full",
                    "nai-diffusion-5-full-inpainting",
                    "nai-diffusion-5-full-medium",
                    "nai-diffusion-5-full-medium-inpainting",
                    "nai-diffusion-4-5-curated",
                    "nai-diffusion-4-5-curated-inpainting",
                    "nai-diffusion-4-5-full",
                    "nai-diffusion-4-5-full-inpainting",
                    "nai-diffusion-4-curated-preview",
                    "nai-diffusion-4-curated-inpainting",
                    "nai-diffusion-4-full",
                    "nai-diffusion-4-full-inpainting"
                  ]
                }
              }
            }
          }
        ]
      },
      "NovelAINativeDirector": {
        "type": "object",
        "required": [
          "req_type",
          "image",
          "width",
          "height"
        ],
        "additionalProperties": true,
        "properties": {
          "req_type": {
            "type": "string",
            "enum": [
              "bg-removal",
              "declutter",
              "declutter-keep-bubbles",
              "lineart",
              "sketch",
              "colorize",
              "emotion"
            ]
          },
          "image": {
            "type": "string",
            "minLength": 1,
            "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
          },
          "width": {
            "type": "integer",
            "minimum": 1
          },
          "height": {
            "type": "integer",
            "minimum": 1
          },
          "prompt": {
            "type": "string"
          },
          "defry": {
            "type": "integer"
          },
          "emotion": {
            "type": "string"
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ],
            "description": "Optional explicit routing model; otherwise use a model enabled for this key."
          }
        }
      },
      "NovelAINativeUpscale": {
        "type": "object",
        "required": [
          "image"
        ],
        "additionalProperties": true,
        "description": "Fixed 2x upscale, input pixels <=3145728. Base64 dimensions are detected automatically. Legacy dimensions may be supplied for estimates; submissions verify the source image.",
        "properties": {
          "image": {
            "type": "string",
            "minLength": 1,
            "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-inpainting",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-5-full-medium-inpainting",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting",
              "nai-diffusion-3",
              "nai-diffusion-3-inpainting",
              "nai-diffusion-furry-3",
              "nai-diffusion-furry-3-inpainting"
            ],
            "default": "nai-diffusion-5-curated"
          },
          "declared_blur_sigma": {
            "type": "number",
            "minimum": 0,
            "default": 0
          },
          "width": {
            "type": "integer",
            "minimum": 1
          },
          "height": {
            "type": "integer",
            "minimum": 1
          },
          "scale": {
            "type": "integer",
            "enum": [
              2
            ]
          }
        }
      },
      "NovelAINativeVibe": {
        "type": "object",
        "required": [
          "image",
          "model"
        ],
        "additionalProperties": true,
        "properties": {
          "image": {
            "type": "string",
            "minLength": 1,
            "description": "Accessible HTTP(S) image URL, image Data URL, or raw Base64. Never a blob: URL or local path."
          },
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-curated-inpainting",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-5-full-inpainting",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-curated-inpainting",
              "nai-diffusion-4-full",
              "nai-diffusion-4-full-inpainting"
            ]
          },
          "information_extracted": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1
          },
          "mask": {}
        }
      },
      "NovelAINativeError": {
        "type": "object",
        "required": [
          "statusCode",
          "message",
          "error"
        ],
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "properties": {
              "invalidKeys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "NovelAIOpenAIImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "nai-diffusion-5-curated",
              "nai-diffusion-5-full",
              "nai-diffusion-5-full-medium",
              "nai-diffusion-4-5-curated",
              "nai-diffusion-4-5-full",
              "nai-diffusion-4-curated-preview",
              "nai-diffusion-4-full",
              "nai-diffusion-3",
              "nai-diffusion-furry-3"
            ]
          },
          "prompt": {
            "type": "string",
            "minLength": 1
          },
          "n": {
            "type": "integer",
            "const": 1,
            "default": 1
          },
          "size": {
            "type": "string",
            "pattern": "^(auto|[1-9][0-9]*x[1-9][0-9]*)$",
            "description": "Positive multiples of 64; at most 3145728 pixels. Omitted/auto uses nai dimensions, each defaulting to 1024. Must agree with any nai.width/height."
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ],
            "default": "url"
          },
          "nai": {
            "type": "object",
            "additionalProperties": true,
            "description": "Official generation parameters. Single image only. No image, mask or stream: use the native/task API for those. prompt and nai.uc determine the base captions; character captions are retained.",
            "properties": {
              "width": {
                "type": "integer",
                "minimum": 1
              },
              "height": {
                "type": "integer",
                "minimum": 1
              },
              "steps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 50
              },
              "n_samples": {
                "type": "integer",
                "const": 1,
                "default": 1,
                "description": "Omitted is accounted as one sample; raw native/task payloads are not modified to insert it. Explicit values other than 1 are rejected."
              },
              "params_version": {
                "type": "integer",
                "description": "4 for V5; 3 in V3/V4/V4.5 examples."
              },
              "scale": {
                "type": "number"
              },
              "seed": {
                "type": "integer",
                "minimum": 0
              },
              "sampler": {
                "type": "string"
              },
              "noise_schedule": {
                "type": "string"
              },
              "uc": {
                "type": "string"
              },
              "image_format": {
                "type": "string",
                "enum": [
                  "png",
                  "webp"
                ],
                "description": "Streaming defaults to png; explicit webp preserves original format."
              },
              "stream": false,
              "image": false,
              "mask": false,
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "upscaled_enhance": {
                "type": "boolean",
                "description": "V5 img2img Max Enhance. Keep input width/height; output is up to 2x, capped at 3145728 pixels. Pricing uses output dimensions."
              },
              "v4_prompt": {
                "type": "object",
                "additionalProperties": true
              },
              "v4_negative_prompt": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "url": "https://api.hamubox.com/docs/",
    "description": "Model limits, billing and integration guide"
  }
}
