@imgly/plugin-ai-video-generation-web
Version:
AI video generation plugin for the CE.SDK editor
58 lines (57 loc) • 1.86 kB
TypeScript
/**
* Runware HTTP REST API client for video generation
* Uses the REST API instead of the WebSocket SDK
* API documentation: https://runware.ai/docs/en/video-inference/api-reference
*
* Video generation uses async delivery with polling:
* 1. Submit task with deliveryMethod: "async"
* 2. Receive taskUUID in response
* 3. Poll with getResponse until status is "success" or "failed"
*/
export interface FrameImage {
inputImage: string;
frame?: 'first' | 'last' | number;
}
export interface RunwareVideoInferenceParams {
model: string;
positivePrompt?: string;
width?: number;
height?: number;
negativePrompt?: string;
numberResults?: number;
outputType?: 'URL' | 'base64Data' | 'dataURI';
outputFormat?: 'MP4' | 'WEBM' | 'GIF';
duration?: number;
fps?: number;
seed?: number;
frameImages?: FrameImage[];
providerSettings?: Record<string, unknown>;
[key: string]: unknown;
}
/**
* Partial params that can be spread together to form complete params.
* Used when some params come from options and some from mapInput.
*/
export type RunwareVideoInferenceInput = Partial<RunwareVideoInferenceParams> & {
[key: string]: unknown;
};
export interface RunwareVideoResult {
taskType: string;
taskUUID: string;
status?: 'processing' | 'success' | 'failed';
videoURL?: string;
videoUUID?: string;
seed?: number;
NSFWContent?: boolean;
cost?: number;
errorMessage?: string;
}
export interface RunwareErrorResponse {
errorId: number;
errorMessage: string;
taskUUID?: string;
}
export interface RunwareClient {
videoInference: (params: RunwareVideoInferenceInput, abortSignal?: AbortSignal) => Promise<RunwareVideoResult[]>;
}
export declare function createRunwareClient(proxyUrl: string, headers?: Record<string, string>): RunwareClient;