@imgly/plugin-ai-image-generation-web
Version:
AI image generation plugin for the CE.SDK editor
57 lines (56 loc) • 1.8 kB
TypeScript
/**
* Runware HTTP REST API client
* Uses the REST API instead of the WebSocket SDK
* API documentation: https://runware.ai/docs/en/getting-started/how-to-connect
*/
export interface RunwareImageInferenceParams {
model: string;
positivePrompt: string;
width?: number;
height?: number;
negativePrompt?: string;
numberResults?: number;
outputType?: 'URL' | 'base64Data' | 'dataURI';
outputFormat?: 'PNG' | 'JPG' | 'WEBP';
outputQuality?: number;
steps?: number;
CFGScale?: number;
seed?: number;
scheduler?: string;
seedImage?: string;
maskImage?: string;
strength?: number;
/** Model-specific inputs (e.g., referenceImages for FLUX.2 [dev]) */
inputs?: {
referenceImages?: string[];
[key: string]: unknown;
};
/** Root-level reference images (for models like GPT Image 1 that don't use nested inputs) */
referenceImages?: string[];
[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 RunwareImageInferenceInput = Partial<RunwareImageInferenceParams> & {
[key: string]: unknown;
};
export interface RunwareImageResult {
taskType: string;
taskUUID: string;
imageURL: string;
imageUUID?: string;
seed?: number;
NSFWContent?: boolean;
cost?: number;
}
export interface RunwareErrorResponse {
errorId: number;
errorMessage: string;
taskUUID?: string;
}
export interface RunwareClient {
imageInference: (params: RunwareImageInferenceInput, abortSignal?: AbortSignal) => Promise<RunwareImageResult[]>;
}
export declare function createRunwareClient(proxyUrl: string, headers?: Record<string, string>): RunwareClient;