text_to_image
Generate an image from a text description. Supports customization of size, steps, and style models for tailored results.
Instructions
Generate an image from text prompt using WaveSpeed AI.
Args:
prompt (str): Required. Text description of the image to generate. MUST BE IN ENGLISH. Non-English prompts will be rejected or result in poor quality outputs.
model (str, optional): Model to use for image generation.
loras (list, optional): List of LoRA models to use, each with a path and scale. Format: [{"path": "model_path", "scale": weight_value}]. Default model used if not provided.
size (str, optional): Size of the output image in format "width*height", e.g., "512*512". Default: 1024*1024.
num_inference_steps (int, optional): Number of denoising steps. Higher values improve quality but increase generation time. Default: 30.
guidance_scale (float, optional): Guidance scale for text adherence. Controls how closely the image matches the text description. Default: 7.5.
num_images (int, optional): Number of images to generate. Default: 1.
seed (int, optional): Random seed for reproducible results. Set to -1 for random. Default: -1.
enable_safety_checker (bool, optional): Whether to enable safety filtering. Default: True.
output_directory (str, optional): Directory to save the generated images. Uses a temporary directory if not provided.
request_id (str, optional): Request correlation ID for tracing the entire request chain. Strongly recommended to provide a unique ID (e.g., UUID) to correlate logs across the request lifecycle.
Returns:
WaveSpeedResult object with the result of the image generation, containing:
- status: "success" or "error"
- urls: List of image URLs if successful
- base64: List of base64 encoded images if resource_mode is set to base64
- local_files: List of local file paths if resource_mode is set to local
- error: Error message if status is "error"
- processing_time: Time taken to generate the image(s)
Examples:
Basic usage: text_to_image(prompt="A golden retriever running on grass")
Advanced usage: text_to_image(
prompt="A golden retriever running on grass",
size="1024*1024",
num_inference_steps=50,
seed=42
)
Note:
For optimal results, always provide prompts in English, regardless of your interface language.
Non-English prompts may result in lower quality or unexpected images.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| model | No | ||
| loras | No | ||
| size | No | 1024*1024 | |
| num_inference_steps | No | ||
| guidance_scale | No | ||
| num_images | No | ||
| seed | No | ||
| enable_safety_checker | No | ||
| output_directory | No | ||
| request_id | No |