mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-07 03:37:04 +08:00
432 lines
14 KiB
Python
432 lines
14 KiB
Python
# generated by datamodel-codegen:
|
|
# filename: filtered-openapi.yaml
|
|
# timestamp: 2025-04-25T03:57:04+00:00
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
from pydantic import BaseModel, Field, confloat, conint, constr
|
|
|
|
|
|
class OutputFormat(str, Enum):
|
|
png = 'png'
|
|
webp = 'webp'
|
|
jpeg = 'jpeg'
|
|
|
|
|
|
class BFLFluxProGenerateRequest(BaseModel):
|
|
prompt: str = Field(..., description='The text prompt for image generation.')
|
|
prompt_upsampling: Optional[bool] = Field(
|
|
None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.'
|
|
)
|
|
seed: Optional[int] = Field(None, description='The seed value for reproducibility.')
|
|
aspect_ratio: Optional[str] = Field(None, description='Aspect ratio of the image between 21:9 and 9:21.')
|
|
safety_tolerance: Optional[conint(ge=0, le=6)] = Field(
|
|
6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.'
|
|
)
|
|
output_format: Optional[OutputFormat] = Field(
|
|
OutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png']
|
|
)
|
|
raw: Optional[bool] = Field(None, description='Generate less processed, more natural-looking images.')
|
|
image_prompt: Optional[str] = Field(None, description='Optional image to remix in base64 format')
|
|
image_prompt_strength: Optional[confloat(ge=0.0, le=1.0)] = Field(
|
|
None, description='Blend between the prompt and the image prompt.'
|
|
)
|
|
|
|
|
|
class BFLFluxProGenerateResponse(BaseModel):
|
|
id: str = Field(..., description='The unique identifier for the generation task.')
|
|
polling_url: str = Field(..., description='URL to poll for the generation result.')
|
|
|
|
|
|
class BFLStatus(str, Enum):
|
|
task_not_found = "Task not found"
|
|
pending = "Pending"
|
|
request_moderated = "Request Moderated"
|
|
content_moderated = "Content Moderated"
|
|
ready = "Ready"
|
|
error = "Error"
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
error: str
|
|
message: str
|
|
|
|
|
|
class ImageRequest(BaseModel):
|
|
aspect_ratio: Optional[str] = Field(
|
|
None,
|
|
description="Optional. The aspect ratio (e.g., 'ASPECT_16_9', 'ASPECT_1_1'). Cannot be used with resolution. Defaults to 'ASPECT_1_1' if unspecified.",
|
|
)
|
|
color_palette: Optional[Dict[str, Any]] = Field(
|
|
None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.'
|
|
)
|
|
magic_prompt_option: Optional[str] = Field(
|
|
None, description="Optional. MagicPrompt usage ('AUTO', 'ON', 'OFF')."
|
|
)
|
|
model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')")
|
|
negative_prompt: Optional[str] = Field(
|
|
None,
|
|
description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.',
|
|
)
|
|
num_images: Optional[conint(ge=1, le=8)] = Field(
|
|
1, description='Optional. Number of images to generate (1-8). Defaults to 1.'
|
|
)
|
|
prompt: str = Field(
|
|
..., description='Required. The prompt to use to generate the image.'
|
|
)
|
|
resolution: Optional[str] = Field(
|
|
None,
|
|
description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.",
|
|
)
|
|
seed: Optional[conint(ge=0, le=2147483647)] = Field(
|
|
None, description='Optional. A number between 0 and 2147483647.'
|
|
)
|
|
style_type: Optional[str] = Field(
|
|
None,
|
|
description="Optional. Style type ('AUTO', 'GENERAL', 'REALISTIC', 'DESIGN', 'RENDER_3D', 'ANIME'). Only for models V_2 and above.",
|
|
)
|
|
|
|
|
|
class IdeogramGenerateRequest(BaseModel):
|
|
image_request: ImageRequest = Field(
|
|
..., description='The image generation request parameters.'
|
|
)
|
|
|
|
|
|
class Datum(BaseModel):
|
|
is_image_safe: Optional[bool] = Field(
|
|
None, description='Indicates whether the image is considered safe.'
|
|
)
|
|
prompt: Optional[str] = Field(
|
|
None, description='The prompt used to generate this image.'
|
|
)
|
|
resolution: Optional[str] = Field(
|
|
None, description="The resolution of the generated image (e.g., '1024x1024')."
|
|
)
|
|
seed: Optional[int] = Field(
|
|
None, description='The seed value used for this generation.'
|
|
)
|
|
style_type: Optional[str] = Field(
|
|
None,
|
|
description="The style type used for generation (e.g., 'REALISTIC', 'ANIME').",
|
|
)
|
|
url: Optional[str] = Field(None, description='URL to the generated image.')
|
|
|
|
|
|
class IdeogramGenerateResponse(BaseModel):
|
|
created: Optional[datetime] = Field(
|
|
None, description='Timestamp when the generation was created.'
|
|
)
|
|
data: Optional[List[Datum]] = Field(
|
|
None, description='Array of generated image information.'
|
|
)
|
|
|
|
|
|
class Code(Enum):
|
|
int_1100 = 1100
|
|
int_1101 = 1101
|
|
int_1102 = 1102
|
|
int_1103 = 1103
|
|
|
|
|
|
class Code1(Enum):
|
|
int_1000 = 1000
|
|
int_1001 = 1001
|
|
int_1002 = 1002
|
|
int_1003 = 1003
|
|
int_1004 = 1004
|
|
|
|
|
|
class KlingErrorResponse(BaseModel):
|
|
code: int = Field(
|
|
..., description='Error code value as defined in the API documentation'
|
|
)
|
|
message: str = Field(..., description='Human-readable error message')
|
|
request_id: str = Field(
|
|
..., description='Request ID for tracking and troubleshooting'
|
|
)
|
|
|
|
|
|
class Code2(Enum):
|
|
int_1200 = 1200
|
|
int_1201 = 1201
|
|
int_1202 = 1202
|
|
int_1203 = 1203
|
|
|
|
|
|
class KlingRequestError(KlingErrorResponse):
|
|
code: Optional[Code2] = Field(
|
|
None,
|
|
description='- 1200: Invalid request parameters\n- 1201: Invalid parameters\n- 1202: Invalid request method\n- 1203: Requested resource does not exist\n',
|
|
)
|
|
|
|
|
|
class Code3(Enum):
|
|
int_5000 = 5000
|
|
int_5001 = 5001
|
|
int_5002 = 5002
|
|
|
|
|
|
class KlingServerError(KlingErrorResponse):
|
|
code: Optional[Code3] = Field(
|
|
None,
|
|
description='- 5000: Internal server error\n- 5001: Service temporarily unavailable\n- 5002: Server internal timeout\n',
|
|
)
|
|
|
|
|
|
class Code4(Enum):
|
|
int_1300 = 1300
|
|
int_1301 = 1301
|
|
int_1302 = 1302
|
|
int_1303 = 1303
|
|
int_1304 = 1304
|
|
|
|
|
|
class KlingStrategyError(KlingErrorResponse):
|
|
code: Optional[Code4] = Field(
|
|
None,
|
|
description='- 1300: Trigger platform strategy\n- 1301: Trigger content security policy\n- 1302: API request too frequent\n- 1303: Concurrency/QPS exceeds limit\n- 1304: Trigger IP whitelist policy\n',
|
|
)
|
|
|
|
|
|
class MinimaxBaseResponse(BaseModel):
|
|
status_code: int = Field(
|
|
...,
|
|
description='Status code. 0 indicates success, other values indicate errors.',
|
|
)
|
|
status_msg: str = Field(
|
|
..., description='Specific error details or success message.'
|
|
)
|
|
|
|
|
|
class File(BaseModel):
|
|
bytes: Optional[int] = Field(None, description='File size in bytes')
|
|
created_at: Optional[int] = Field(
|
|
None, description='Unix timestamp when the file was created, in seconds'
|
|
)
|
|
download_url: Optional[str] = Field(
|
|
None, description='The URL to download the video'
|
|
)
|
|
file_id: Optional[int] = Field(None, description='Unique identifier for the file')
|
|
filename: Optional[str] = Field(None, description='The name of the file')
|
|
purpose: Optional[str] = Field(None, description='The purpose of using the file')
|
|
|
|
|
|
class MinimaxFileRetrieveResponse(BaseModel):
|
|
base_resp: MinimaxBaseResponse
|
|
file: File
|
|
|
|
|
|
class Status(str, Enum):
|
|
Queueing = 'Queueing'
|
|
Preparing = 'Preparing'
|
|
Processing = 'Processing'
|
|
Success = 'Success'
|
|
Fail = 'Fail'
|
|
|
|
|
|
class MinimaxTaskResultResponse(BaseModel):
|
|
base_resp: MinimaxBaseResponse
|
|
file_id: Optional[str] = Field(
|
|
None,
|
|
description='After the task status changes to Success, this field returns the file ID corresponding to the generated video.',
|
|
)
|
|
status: Status = Field(
|
|
...,
|
|
description="Task status: 'Queueing' (in queue), 'Preparing' (task is preparing), 'Processing' (generating), 'Success' (task completed successfully), or 'Fail' (task failed).",
|
|
)
|
|
task_id: str = Field(..., description='The task ID being queried.')
|
|
|
|
|
|
class Model(str, Enum):
|
|
T2V_01_Director = 'T2V-01-Director'
|
|
I2V_01_Director = 'I2V-01-Director'
|
|
S2V_01 = 'S2V-01'
|
|
I2V_01 = 'I2V-01'
|
|
I2V_01_live = 'I2V-01-live'
|
|
T2V_01 = 'T2V-01'
|
|
|
|
|
|
class SubjectReferenceItem(BaseModel):
|
|
image: Optional[str] = Field(
|
|
None, description='URL or base64 encoding of the subject reference image.'
|
|
)
|
|
mask: Optional[str] = Field(
|
|
None,
|
|
description='URL or base64 encoding of the mask for the subject reference image.',
|
|
)
|
|
|
|
|
|
class MinimaxVideoGenerationRequest(BaseModel):
|
|
callback_url: Optional[str] = Field(
|
|
None,
|
|
description='Optional. URL to receive real-time status updates about the video generation task.',
|
|
)
|
|
first_frame_image: Optional[str] = Field(
|
|
None,
|
|
description='URL or base64 encoding of the first frame image. Required when model is I2V-01, I2V-01-Director, or I2V-01-live.',
|
|
)
|
|
model: Model = Field(
|
|
...,
|
|
description='Required. ID of model. Options: T2V-01-Director, I2V-01-Director, S2V-01, I2V-01, I2V-01-live, T2V-01',
|
|
)
|
|
prompt: Optional[constr(max_length=2000)] = Field(
|
|
None,
|
|
description='Description of the video. Should be less than 2000 characters. Supports camera movement instructions in [brackets].',
|
|
)
|
|
prompt_optimizer: Optional[bool] = Field(
|
|
True,
|
|
description='If true (default), the model will automatically optimize the prompt. Set to false for more precise control.',
|
|
)
|
|
subject_reference: Optional[List[SubjectReferenceItem]] = Field(
|
|
None,
|
|
description='Only available when model is S2V-01. The model will generate a video based on the subject uploaded through this parameter.',
|
|
)
|
|
|
|
|
|
class MinimaxVideoGenerationResponse(BaseModel):
|
|
base_resp: MinimaxBaseResponse
|
|
task_id: str = Field(
|
|
..., description='The task ID for the asynchronous video generation task.'
|
|
)
|
|
|
|
|
|
class Moderation(str, Enum):
|
|
low = 'low'
|
|
auto = 'auto'
|
|
|
|
|
|
class OpenAIImageEditRequest(BaseModel):
|
|
background: Optional[str] = Field(
|
|
None, description='Background transparency', examples=['opaque']
|
|
)
|
|
model: str = Field(
|
|
..., description='The model to use for image editing', examples=['gpt-image-1']
|
|
)
|
|
moderation: Optional[Moderation] = Field(
|
|
None, description='Content moderation setting', examples=['auto']
|
|
)
|
|
n: Optional[int] = Field(
|
|
None, description='The number of images to generate', examples=[1]
|
|
)
|
|
output_compression: Optional[int] = Field(
|
|
None, description='Compression level for JPEG or WebP (0-100)', examples=[100]
|
|
)
|
|
output_format: Optional[OutputFormat] = Field(
|
|
None, description='Format of the output image', examples=['png']
|
|
)
|
|
prompt: str = Field(
|
|
...,
|
|
description='A text description of the desired edit',
|
|
examples=['Give the rocketship rainbow coloring'],
|
|
)
|
|
quality: Optional[str] = Field(
|
|
None, description='The quality of the edited image', examples=['low']
|
|
)
|
|
size: Optional[str] = Field(
|
|
None, description='Size of the output image', examples=['1024x1024']
|
|
)
|
|
user: Optional[str] = Field(
|
|
None,
|
|
description='A unique identifier for end-user monitoring',
|
|
examples=['user-1234'],
|
|
)
|
|
|
|
|
|
class Background(str, Enum):
|
|
transparent = 'transparent'
|
|
opaque = 'opaque'
|
|
|
|
|
|
class Quality(str, Enum):
|
|
low = 'low'
|
|
medium = 'medium'
|
|
high = 'high'
|
|
standard = 'standard'
|
|
hd = 'hd'
|
|
|
|
|
|
class ResponseFormat(str, Enum):
|
|
url = 'url'
|
|
b64_json = 'b64_json'
|
|
|
|
|
|
class Style(str, Enum):
|
|
vivid = 'vivid'
|
|
natural = 'natural'
|
|
|
|
|
|
class OpenAIImageGenerationRequest(BaseModel):
|
|
background: Optional[Background] = Field(
|
|
None, description='Background transparency', examples=['opaque']
|
|
)
|
|
model: Optional[str] = Field(
|
|
None, description='The model to use for image generation', examples=['dall-e-3']
|
|
)
|
|
moderation: Optional[Moderation] = Field(
|
|
None, description='Content moderation setting', examples=['auto']
|
|
)
|
|
n: Optional[int] = Field(
|
|
None,
|
|
description='The number of images to generate (1-10). Only 1 supported for dall-e-3.',
|
|
examples=[1],
|
|
)
|
|
output_compression: Optional[int] = Field(
|
|
None, description='Compression level for JPEG or WebP (0-100)', examples=[100]
|
|
)
|
|
output_format: Optional[OutputFormat] = Field(
|
|
None, description='Format of the output image', examples=['png']
|
|
)
|
|
prompt: str = Field(
|
|
...,
|
|
description='A text description of the desired image',
|
|
examples=['Draw a rocket in front of a blackhole in deep space'],
|
|
)
|
|
quality: Optional[Quality] = Field(
|
|
None, description='The quality of the generated image', examples=['high']
|
|
)
|
|
response_format: Optional[ResponseFormat] = Field(
|
|
None, description='Response format of image data', examples=['b64_json']
|
|
)
|
|
size: Optional[str] = Field(
|
|
None,
|
|
description='Size of the image (e.g., 1024x1024, 1536x1024, auto)',
|
|
examples=['1024x1536'],
|
|
)
|
|
style: Optional[Style] = Field(
|
|
None, description='Style of the image (only for dall-e-3)', examples=['vivid']
|
|
)
|
|
user: Optional[str] = Field(
|
|
None,
|
|
description='A unique identifier for end-user monitoring',
|
|
examples=['user-1234'],
|
|
)
|
|
|
|
|
|
class Datum1(BaseModel):
|
|
b64_json: Optional[str] = Field(None, description='Base64 encoded image data')
|
|
revised_prompt: Optional[str] = Field(None, description='Revised prompt')
|
|
url: Optional[str] = Field(None, description='URL of the image')
|
|
|
|
|
|
class OpenAIImageGenerationResponse(BaseModel):
|
|
data: Optional[List[Datum1]] = None
|
|
|
|
|
|
class KlingAccountError(KlingErrorResponse):
|
|
code: Optional[Code] = Field(
|
|
None,
|
|
description='- 1100: Account exception\n- 1101: Account in arrears (postpaid scenario)\n- 1102: Resource pack depleted or expired (prepaid scenario)\n- 1103: Unauthorized access to requested resource\n',
|
|
)
|
|
|
|
|
|
class KlingAuthenticationError(KlingErrorResponse):
|
|
code: Optional[Code1] = Field(
|
|
None,
|
|
description='- 1000: Authentication failed\n- 1001: Authorization is empty\n- 1002: Authorization is invalid\n- 1003: Authorization is not yet valid\n- 1004: Authorization has expired\n',
|
|
)
|