/** * RunPod Serverless Client * * Client for communicating with ComfyUI deployed as a RunPod serverless endpoint. * Provides stable URL (no more changing pod IDs!) and auto-scaling. * * Usage: * const client = new RunPodServerlessClient(endpointId, apiKey); * const result = await client.portrait({ description: "Viking warrior" }); */ export interface RunPodConfig { endpointId: string; apiKey: string; timeout?: number; } export interface PortraitParams { description?: string; prompt?: string; negative_prompt?: string; model?: string; width?: number; height?: number; steps?: number; cfg_scale?: number; seed?: number; } export interface TTSParams { text: string; voice_reference: string; voice_reference_text?: string; speed?: number; seed?: number; } export interface LipSyncParams { portrait_image: string; audio: string; svd_checkpoint?: string; sonic_unet?: string; inference_steps?: number; fps?: number; } export interface RunPodFile { type: "image" | "video" | "audio"; filename: string; data?: string; encoding?: "base64"; path?: string; size_bytes?: number; } export interface RunPodResponse { status: "success" | "error"; action?: string; files?: RunPodFile[]; prompt_id?: string; error?: string; } export interface RunPodJobStatus { id: string; status: "IN_QUEUE" | "IN_PROGRESS" | "COMPLETED" | "FAILED"; output?: RunPodResponse; error?: string; } export declare class RunPodServerlessClient { private endpointId; private apiKey; private timeout; private baseUrl; constructor(config: RunPodConfig); /** * Run a synchronous request (blocks until complete or timeout). * Use for requests expected to complete within 30s. */ runSync(input: Record): Promise; /** * Run an asynchronous request (returns job ID immediately). * Use for long-running requests like lip-sync. */ run(input: Record): Promise; /** * Check status of an async job. */ status(jobId: string): Promise; /** * Wait for an async job to complete. */ waitForCompletion(jobId: string, pollInterval?: number, maxWait?: number): Promise; /** * Health check. */ health(): Promise<{ status: string; comfyui_url?: string; }>; /** * Generate a portrait image. */ portrait(params: PortraitParams): Promise; /** * Generate TTS audio with voice cloning. */ tts(params: TTSParams): Promise; /** * Generate lip-sync video (async, may take 1-2 minutes). */ lipsync(params: LipSyncParams): Promise; /** * Generate full talking head: TTS + lip-sync. */ talkingHead(params: { text: string; voice_reference: string; portrait_image: string; voice_reference_text?: string; speed?: number; }): Promise<{ tts: RunPodResponse; lipsync: RunPodResponse; }>; } /** * Create a client from environment variables. */ export declare function createRunPodClient(): RunPodServerlessClient | null;