StableDiffusionClient

org.llm4s.imagegeneration.provider.StableDiffusionClient

Stable Diffusion WebUI API client for image generation.

This client connects to a locally hosted or remote Stable Diffusion WebUI instance through its REST API. It supports all the standard text-to-image generation features including custom sampling, guidance scale, negative prompts, and more.

Value parameters

config

Configuration containing base URL, API key, and timeout settings

Attributes

Example
val config = StableDiffusionConfig(
 baseUrl = "http://localhost:7860",
 apiKey = Some("your-api-key") // optional
)
val client = new StableDiffusionClient(config)
val options = ImageGenerationOptions(
 size = ImageSize.Square512,
 guidanceScale = 7.5,
 negativePrompt = Some("blurry, low quality")
)
client.generateImage("a beautiful landscape", options) match {
 case Right(image) => println(s"Generated image: $${image.size}")
 case Left(error) => println(s"Error: $${error.message}")
}
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def generateImage(prompt: String, options: ImageGenerationOptions): Either[ImageGenerationError, GeneratedImage]

Generate an image from a text prompt

Generate an image from a text prompt

Attributes

Definition Classes
override def generateImages(prompt: String, count: Int, options: ImageGenerationOptions): Either[ImageGenerationError, Seq[GeneratedImage]]

Generate multiple images from a text prompt

Generate multiple images from a text prompt

Attributes

Definition Classes
override def health(): Either[ImageGenerationError, ServiceStatus]

Check the health/status of the image generation service

Check the health/status of the image generation service

Attributes

Definition Classes