stability-ai
Version:
Node SDK for Stability AI REST API
71 lines (70 loc) • 2.61 kB
TypeScript
import { StabilityAIContentResponse } from '../util';
import StabilityAI from '..';
export type EngineId = 'stable-diffusion-v1-6' | 'stable-diffusion-xl-1024-v1-0';
export type ClipGuidancePreset = 'FAST_BLUE' | 'FAST_GREEN' | 'NONE' | 'SIMPLE' | 'SLOW' | 'SLOWER' | 'SLOWEST';
export type Sampler = 'DDIM' | 'DDPM' | 'K_DPMPP_2M' | 'K_DPMPP_2S_ANCESTRAL' | 'K_DPM_2' | 'K_DPM_2_ANCESTRAL' | 'K_EULER' | 'K_EULER_ANCESTRAL' | 'K_HEUN' | 'K_LMS';
export type StylePreset = '3d-model' | 'analog-film' | 'anime' | 'cinematic' | 'comic-book' | 'digital-art' | 'enhance' | 'fantasy-art' | 'isometric' | 'line-art' | 'low-poly' | 'modeling-compound' | 'neon-punk' | 'origami' | 'photographic' | 'pixel-art' | 'tile-texture';
export type TextPrompt = {
text: string;
weight: number;
};
export type V1GenerationRequiredParams = [
engine_id: EngineId,
text_prompts: TextPrompt[]
];
export type V1GenerationOptionalParams = {
cfg_scale?: number;
clip_guidance_preset?: ClipGuidancePreset;
sampler?: Sampler;
samples?: number;
seed?: number;
steps?: number;
style_preset?: StylePreset;
extras?: object;
};
export type TextToImageOptions = [
...V1GenerationRequiredParams,
options?: {
height?: number;
width?: number;
} & V1GenerationOptionalParams
];
/**
* Stability AI Text To Image (v1)
*
* @param text_prompts - Text prompts to use for generating the image
* @param options - Additional options for the generation
*/
export declare function textToImage(this: StabilityAI, ...args: TextToImageOptions): Promise<StabilityAIContentResponse[]>;
export type ImageToImageOptions = [
...V1GenerationRequiredParams,
init_image: string,
options?: ({
mode: 'IMAGE_STRENGTH';
image_strength?: number;
} | {
mode: 'STEP_SCHEDULE';
step_schedule_start?: number;
step_schedule_end?: number;
}) & V1GenerationOptionalParams
];
/**
* Stability AI Image To Image (v1)
*
*/
export declare function imageToImage(this: StabilityAI, ...args: ImageToImageOptions): Promise<StabilityAIContentResponse[]>;
export type ImageToImageMaskingOptions = [
...V1GenerationRequiredParams,
init_image: string,
options: ({
mask_source: 'MASK_IMAGE_WHITE' | 'MASK_IMAGE_BLACK';
mask_image: string;
} | {
mask_source: 'INIT_IMAGE_ALPHA';
}) & V1GenerationOptionalParams
];
/**
* Stability AI Image To Image Upscale (v1)
*
*/
export declare function imageToImageMasking(this: StabilityAI, ...args: ImageToImageMaskingOptions): Promise<StabilityAIContentResponse[]>;