Files

415 lines
17 KiB
Python

# api_examples.py
# RunPod Public Endpoint parameter definitions
# These are hardcoded endpoint IDs and their default parameter examples
# =============================================================================
# IMAGE GENERATION ENDPOINTS
# =============================================================================
FLUX_DEV = {
"endpoint": "black-forest-labs-flux-1-dev",
"display_name": "Flux Dev",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "A serene mountain landscape at sunset", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"width": ("INT", {"default": 1024, "min": 256, "max": 1536, "step": 64}),
"height": ("INT", {"default": 1024, "min": 256, "max": 1536, "step": 64}),
"num_inference_steps": ("INT", {"default": 28, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 7.5, "min": 0.0, "max": 10.0, "step": 0.1}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"image_format": (["png", "jpeg"], {"default": "png"}),
}
}
FLUX_SCHNELL = {
"endpoint": "black-forest-labs-flux-1-schnell",
"display_name": "Flux Schnell",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "A quick sketch of a mountain", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"width": ("INT", {"default": 1024, "min": 256, "max": 1536, "step": 64}),
"height": ("INT", {"default": 1024, "min": 256, "max": 1536, "step": 64}),
"num_inference_steps": ("INT", {"default": 4, "min": 1, "max": 8}),
"guidance": ("FLOAT", {"default": 7.5, "min": 0.0, "max": 10.0, "step": 0.1}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"image_format": (["png", "jpeg"], {"default": "jpeg"}),
}
}
FLUX_KONTEXT_DEV = {
"endpoint": "black-forest-labs-flux-1-kontext-dev",
"display_name": "Flux Kontext Dev (Image Edit)",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "Edit the image to change the background", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}), # URL input
"size": ("STRING", {"default": "1024*1024", "multiline": False}),
"num_inference_steps": ("INT", {"default": 28, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"output_format": (["png", "jpeg"], {"default": "png"}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
}
QWEN_IMAGE = {
"endpoint": "qwen-image-t2i",
"display_name": "Qwen Image",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "A fashion-forward woman sitting at cobblestone street in Paris", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1024*1024", "multiline": False}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
}
}
QWEN_IMAGE_LORA = {
"endpoint": "qwen-image-t2i-lora",
"display_name": "Qwen Image LoRA",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "Real life Anime in a cozy kitchen", "multiline": True}),
"loras": ("STRING", {"default": "[]", "multiline": True}), # JSON array
"size": ("STRING", {"default": "1024*1024", "multiline": False}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
}
}
QWEN_IMAGE_EDIT = {
"endpoint": "qwen-image-edit",
"display_name": "Qwen Image Edit",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "change the color to light grey", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"output_format": (["png", "jpeg"], {"default": "png"}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
}
SEEDREAM_3 = {
"endpoint": "seedream-3-0-t2i",
"display_name": "Seedream 3.0",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "Hyper-realistic photograph of a deep-sea diver", "multiline": True}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"guidance": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"size": ("STRING", {"default": "1024x1024", "multiline": False}),
}
}
SEEDREAM_4_T2I = {
"endpoint": "seedream-v4-t2i",
"display_name": "Seedream 4.0 T2I",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "American retro 1950s illustration style", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1024*1024", "multiline": False}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
}
}
SEEDREAM_4_EDIT = {
"endpoint": "seedream-v4-edit",
"display_name": "Seedream 4.0 Edit",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "Dress the model in the clothes and hat", "multiline": True}),
"images": ("STRING", {"default": "[]", "multiline": True}), # JSON array of URLs
"size": ("STRING", {"default": "1024*1024", "multiline": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"num_image_inputs": 2,
}
NANO_BANANA_EDIT = {
"endpoint": "nano-banana-edit",
"display_name": "Nano Banana Edit (Image Combination)",
"category": "Image",
"params": {
"prompt": ("STRING", {"default": "Combine these images into a single realistic scene", "multiline": True}),
"images": ("STRING", {"default": "[]", "multiline": True}), # JSON array of URLs
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"num_image_inputs": 2,
}
# =============================================================================
# VIDEO GENERATION ENDPOINTS
# =============================================================================
INFINITETALK = {
"endpoint": "infinitetalk",
"display_name": "InfiniteTalk",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "a cartoon computer talking", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"audio": ("STRING", {"default": "", "multiline": False}),
"size": (["480p", "720p"], {"default": "480p"}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
KLING_V21_I2V_PRO = {
"endpoint": "kling-v2-1-i2v-pro",
"display_name": "Kling v2.1 I2V Pro",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "A majestic dragon breathing fire over an ancient castle", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"guidance_scale": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.1}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
SEEDANCE_1_PRO = {
"endpoint": "seedance-1-0-pro",
"display_name": "Seedance 1.0 Pro",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "A pristine Porsche 911 photographed in golden hour lighting", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"fps": ("INT", {"default": 24, "min": 12, "max": 60}),
"size": ("STRING", {"default": "1920x1080", "multiline": False}),
},
"accepts_image": True,
"output_type": "video",
}
SORA_2_I2V = {
"endpoint": "sora-2-i2v",
"display_name": "SORA 2 I2V",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "Action: The character moves slowly forward. Ambient Sound: Distant echoes.", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"duration": (["4", "8", "12"], {"default": "4"}),
},
"accepts_image": True,
"output_type": "video",
}
SORA_2_PRO_I2V = {
"endpoint": "sora-2-pro-i2v",
"display_name": "SORA 2 Pro I2V",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "Action: She opened her hands. Ambient Sound: Soft crackling.", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"size": ("STRING", {"default": "720p", "multiline": False}),
"duration": (["4", "8", "12"], {"default": "4"}),
},
"accepts_image": True,
"output_type": "video",
}
WAN_25 = {
"endpoint": "wan-2-5",
"display_name": "WAN 2.5 I2V",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "A stand-up comedian delivering a dad joke", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1280*720", "multiline": False}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_prompt_expansion": ("BOOLEAN", {"default": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
WAN_22_I2V_720_LORA = {
"endpoint": "wan-2-2-t2v-720-lora",
"display_name": "WAN 2.2 I2V 720p LoRA",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "orbit 180 around an astronaut on the moon", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"high_noise_loras": ("STRING", {"default": "[]", "multiline": True}),
"low_noise_loras": ("STRING", {"default": "[]", "multiline": True}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
WAN_22_I2V_720 = {
"endpoint": "wan-2-2-i2v-720",
"display_name": "WAN 2.2 I2V 720p",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "cinematic shot: slow-tracking camera glides parallel to a giant white origami boat", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1280*720", "multiline": False}),
"num_inference_steps": ("INT", {"default": 30, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"flow_shift": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_prompt_optimization": ("BOOLEAN", {"default": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
WAN_22_T2V_720 = {
"endpoint": "wan-2-2-t2v-720",
"display_name": "WAN 2.2 T2V 720p",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "A serene morning in an ancient forest, golden sunlight filtering through tall pine trees", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1280*720", "multiline": False}),
"num_inference_steps": ("INT", {"default": 30, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"flow_shift": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_prompt_optimization": ("BOOLEAN", {"default": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"output_type": "video",
}
WAN_21_I2V_720 = {
"endpoint": "wan-2-1-i2v-720",
"display_name": "WAN 2.1 I2V 720p",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "The family just took a selfie. They lean in together, smiling and relaxed.", "multiline": True}),
"image": ("STRING", {"default": "", "multiline": False}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1280*720", "multiline": False}),
"num_inference_steps": ("INT", {"default": 30, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"flow_shift": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_prompt_optimization": ("BOOLEAN", {"default": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"accepts_image": True,
"output_type": "video",
}
WAN_21_T2V_720 = {
"endpoint": "wan-2-1-t2v-720",
"display_name": "WAN 2.1 T2V 720p",
"category": "Video",
"params": {
"prompt": ("STRING", {"default": "Steady rain falls on a bustling Tokyo street at night, neon signs casting vibrant pink and blue light", "multiline": True}),
"negative_prompt": ("STRING", {"default": "", "multiline": True}),
"size": ("STRING", {"default": "1280*720", "multiline": False}),
"num_inference_steps": ("INT", {"default": 30, "min": 1, "max": 50}),
"guidance": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 10.0, "step": 0.1}),
"duration": ("INT", {"default": 5, "min": 1, "max": 10}),
"flow_shift": ("INT", {"default": 5, "min": 1, "max": 10}),
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
"enable_prompt_optimization": ("BOOLEAN", {"default": False}),
"enable_safety_checker": ("BOOLEAN", {"default": True}),
},
"output_type": "video",
}
# =============================================================================
# AUDIO ENDPOINTS
# =============================================================================
WHISPER_V3_LARGE = {
"endpoint": "whisper-v3-large",
"display_name": "Whisper V3 Large (Speech-to-Text)",
"category": "Audio",
"params": {
"prompt": ("STRING", {"default": "", "multiline": True}),
"audio": ("STRING", {"default": "", "multiline": False}),
},
"output_type": "text",
}
MINIMAX_SPEECH_02_HD = {
"endpoint": "minimax-speech-02-hd",
"display_name": "Minimax Speech 02 HD (Text-to-Speech)",
"category": "Audio",
"params": {
"prompt": ("STRING", {"default": "Welcome to our advanced text-to-speech system", "multiline": True}),
"voice_id": ("STRING", {"default": "Wise_Woman", "multiline": False}),
"speed": ("FLOAT", {"default": 1.0, "min": 0.5, "max": 2.0, "step": 0.1}),
"volume": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 2.0, "step": 0.1}),
"pitch": ("FLOAT", {"default": 0.0, "min": -1.0, "max": 1.0, "step": 0.1}),
"emotion": (["neutral", "happy", "sad", "angry", "fearful", "disgusted", "surprised"], {"default": "neutral"}),
"english_normalization": ("BOOLEAN", {"default": False}),
},
"output_type": "audio",
}
# =============================================================================
# ALL ENDPOINTS REGISTRY
# =============================================================================
ALL_IMAGE_ENDPOINTS = [
FLUX_DEV,
FLUX_SCHNELL,
FLUX_KONTEXT_DEV,
QWEN_IMAGE,
QWEN_IMAGE_LORA,
QWEN_IMAGE_EDIT,
SEEDREAM_3,
SEEDREAM_4_T2I,
SEEDREAM_4_EDIT,
NANO_BANANA_EDIT,
]
ALL_VIDEO_ENDPOINTS = [
INFINITETALK,
KLING_V21_I2V_PRO,
SEEDANCE_1_PRO,
SORA_2_I2V,
SORA_2_PRO_I2V,
WAN_25,
WAN_22_I2V_720_LORA,
WAN_22_I2V_720,
WAN_22_T2V_720,
WAN_21_I2V_720,
WAN_21_T2V_720,
]
ALL_AUDIO_ENDPOINTS = [
WHISPER_V3_LARGE,
MINIMAX_SPEECH_02_HD,
]
ALL_ENDPOINTS = ALL_IMAGE_ENDPOINTS + ALL_VIDEO_ENDPOINTS + ALL_AUDIO_ENDPOINTS