images
Pydantic models for the Images endpoints.
Classes
ImagesConfig
Bases: BaseModel
Configuration for image generation and editing.
- Code Reference routers images Classes ImagesClient Functions
- Code Reference routers images Classes ImagesClient Functions update_config
Attributes
ENABLE_IMAGE_PROMPT_GENERATION
Enable automatic prompt generation for images.
IMAGE_GENERATION_ENGINE
The engine to use for image generation. Options: 'openai', 'comfyui', 'automatic1111', 'gemini'.
IMAGE_GENERATION_MODEL
The model to use for image generation (e.g. 'dall-e-3', 'sd-xl').
IMAGE_STEPS
The default number of steps for image generation (for engines that support it).
IMAGES_OPENAI_API_BASE_URL
Base URL for OpenAI-compatible image generation API.
IMAGES_OPENAI_API_KEY
API key for OpenAI-compatible image generation API.
IMAGES_OPENAI_API_VERSION
API version for OpenAI-compatible image generation API.
IMAGES_OPENAI_API_PARAMS
Additional parameters for OpenAI-compatible image generation API.
Dict Fields
quality(str, optional): Image quality - 'standard' or 'hd'style(str, optional): Image style - 'vivid' or 'natural'user(str, optional): Unique identifier representing the end-userresponse_format(str, optional): Format of the response - 'url' or 'b64_json'size(str, optional): Override size for this specific request (e.g., '1024x1024')n(int, optional): Override number of images to generate for this request
Additional keys may be supported depending on the OpenAI-compatible API implementation.
AUTOMATIC1111_API_AUTH
Authentication credentials for Automatic1111 API.
Dict Fields
username(str, required): Username for Automatic1111 API authenticationpassword(str, required): Password for Automatic1111 API authentication
Can also be provided as a string in the format 'username:password'. When provided as a string, it will be converted to Basic Auth format.
AUTOMATIC1111_PARAMS
Additional parameters for Automatic1111 API.
Dict Fields
sampler_name(str, optional): Sampler algorithm to use (e.g., 'euler', 'ddim', 'lms')scheduler(str, optional): Scheduler type (e.g., 'normal', 'karras', 'exponential')cfg_scale(float, optional): Classifier-free guidance scale (typically 7-15)denoising_strength(float, optional): Denoising strength for img2img (0.0-1.0)seed(int, optional): Random seed for reproducible results (-1 for random)subseed(int, optional): Subseed for variationsubseed_strength(float, optional): Subseed strength (0.0-1.0)seed_resize_from_h(int, optional): Seed resize from heightseed_resize_from_w(int, optional): Seed resize from widthbatch_size(int, optional): Number of images to generate per promptn_iter(int, optional): Number of iterations/batches to runsteps(int, optional): Number of diffusion stepstiling(bool, optional): Enable tiling for seamless texturesrestore_faces(bool, optional): Enable face restorationenable_hr(bool, optional): Enable high-resolution fixhr_scale(float, optional): High-resolution scale factorhr_upscaler(str, optional): High-resolution upscaler modelhr_second_pass_steps(int, optional): Steps for second high-res passhr_resize_x(int, optional): High-res resize widthhr_resize_y(int, optional): High-res resize heightoverride_settings(dict, optional): Additional settings to overridescript_name(str, optional): Script name to usescript_args(list, optional): Arguments for the scripteta(float, optional): Eta noise multiplier for ancestral samplings_churn(float, optional): Stochasticity churns_tmin(float, optional): Minimum timesteps_tmax(float, optional): Maximum timesteps_noise(float, optional): Noise multiplier
These parameters are passed directly to the Automatic1111 Stable Diffusion WebUI txt2img API. See https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API for full documentation.
COMFYUI_WORKFLOW_NODES
List of nodes in the ComfyUI workflow.
Dict Fields
type(str, required): Type of node (e.g., 'prompt', 'model', 'width', 'height', 'steps', 'seed')key(str, required): Key/parameter name in the ComfyUI workflownode_ids(list[str], required): List of node IDs that correspond to this type
This defines the mapping between workflow parameters and their corresponding node IDs in the ComfyUI workflow.
IMAGES_GEMINI_API_BASE_URL
Base URL for Google Gemini image generation API.
IMAGES_GEMINI_ENDPOINT_METHOD
The method to use for Gemini image generation (e.g. 'predict', 'generateContent').
IMAGES_EDIT_OPENAI_API_BASE_URL
Base URL for OpenAI-compatible image editing API.
IMAGES_EDIT_OPENAI_API_KEY
API key for OpenAI-compatible image editing API.
IMAGES_EDIT_OPENAI_API_VERSION
API version for OpenAI-compatible image editing API.
IMAGES_EDIT_GEMINI_API_BASE_URL
Base URL for Google Gemini image editing API.
IMAGES_EDIT_GEMINI_API_KEY
API key for Google Gemini image editing API.
IMAGES_EDIT_COMFYUI_BASE_URL
Base URL for ComfyUI image editing API.
IMAGES_EDIT_COMFYUI_WORKFLOW_NODES
List of nodes in the ComfyUI image editing workflow.
Dict Fields
type(str, required): Type of node (e.g., 'image', 'prompt', 'model', 'width', 'height')key(str, required): Parameter name/key in the ComfyUI workflownode_ids(list[str], required): List of node IDs corresponding to this typevalue(str, optional): Optional value for the node
This defines the mapping between workflow parameters and their corresponding node IDs in the ComfyUI image editing workflow.
CreateImageForm
Bases: BaseModel
Form for creating an image.
- Code Reference routers images Classes ImagesClient Functions generate_image
Attributes
model
The model to use for image generation. If not provided, the configured default model is used.
size
The size of the generated image (e.g., '512x512'). If not provided, the configured default size is used.
EditImageForm
Bases: BaseModel
Form for editing an image.
- Code Reference routers images Classes ImagesClient Functions edit_image
Attributes
model
The model to use for image editing. If not provided, the configured default model is used.
size
The size of the edited image (e.g., '512x512'). If not provided, the configured default size is used.