org.llm4s.imagegeneration

Members list

Type members

Classlikes

case class AuthenticationError(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class GeneratedImage(data: String, format: ImageFormat, size: ImageSize, createdAt: Instant, prompt: String, seed: Option[Long], filePath: Option[Path], url: Option[String])

Represents a generated image

Represents a generated image

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait HealthStatus

Service health status

Service health status

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Degraded
object Healthy
object Unhealthy
object Unknown
object HealthStatus

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case class HuggingFaceConfig(apiKey: String, model: String, timeout: Int) extends ImageGenerationConfig

Configuration for the HuggingFace Inference API.

Configuration for the HuggingFace Inference API.

Value parameters

apiKey

Your HuggingFace API token. This is required for authentication.

model

The identifier of the model to use on the HuggingFace Hub, e.g., "runwayml/stable-diffusion-v1-5".

timeout

Request timeout in milliseconds. Defaults to a higher value suitable for cloud APIs.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ImageEditOptions(size: Option[ImageSize], n: Int, providerOptions: Option[ProviderImageEditOptions])

Options for image editing

Options for image editing

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait ImageFormat

Image format enumeration

Image format enumeration

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object JPEG
object PNG
object WEBP
object ImageFormat

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed trait ImageGenerationError

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class ImageGenerationOptions(size: ImageSize, format: ImageFormat, seed: Option[Long], guidanceScale: Double, inferenceSteps: Int, negativePrompt: Option[String], samplerName: Option[String], quality: Option[String], style: Option[String], responseFormat: Option[String], outputFormat: Option[String], background: Option[String], outputCompression: Option[Int], user: Option[String])

Options for image generation

Options for image generation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Providers for image generation

Providers for image generation

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object DALLE
object HuggingFace
object StabilityAI

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Registry of image generation model pricing.

Registry of image generation model pricing.

Provides per-image cost lookup for supported image generation models. Costs are in USD per image and vary by model, size, and quality.

Pricing sources:

Attributes

See also

org.llm4s.model.ModelPricing for LLM token-based pricing

Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait ImageSize

Image size enumeration

Image size enumeration

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Auto
class Custom
object Square1024
object Square512
Show all
object ImageSize

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
ImageSize.type

Decorator that wraps an ImageGenerationClient with metrics collection and trace event emission.

Decorator that wraps an ImageGenerationClient with metrics collection and trace event emission.

Records:

  • observeImageGeneration for every generate/edit call (success or failure)
  • recordImageGenerationCost when pricing is available via ImagePricingRegistry
  • TraceEvent.ImageGenerationCompleted for observability

Note: Cost estimation uses the requested size, not the actual provider-billed dimensions. For models like dall-e-3 that normalize sizes (e.g., mapping non-standard requested sizes to their nearest supported size), the estimate may differ from actual billing. When size is unknown (e.g., edit operations without an explicit size), cost estimation is skipped.

Value parameters

config

Image generation configuration (provides model/provider info)

delegate

The underlying client to delegate actual generation to

metrics

Metrics collector for Prometheus counters/histograms

tracing

Tracing backend for structured event emission

Attributes

Supertypes
class Object
trait Matchable
class Any
case class InsufficientResourcesError(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class InvalidPromptError(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class OpenAIConfig(apiKey: String, model: String, baseUrl: String, timeout: Int) extends ImageGenerationConfig

Configuration for OpenAI DALL-E API.

Configuration for OpenAI DALL-E API.

Value parameters

apiKey

Your OpenAI API key. This is required for authentication.

model

The DALL-E model version to use (dall-e-2 or dall-e-3).

timeout

Request timeout in milliseconds.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Provider-specific edit options; keeps shared API provider-agnostic.

Provider-specific edit options; keeps shared API provider-agnostic.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class OpenAI

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case class RateLimitError(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ServiceError(message: String, code: Int) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ServiceStatus(status: HealthStatus, message: String, lastChecked: Instant, queueLength: Option[Int], averageGenerationTime: Option[Long])

Represents the status of the image generation service

Represents the status of the image generation service

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class StabilityAIConfig(apiKey: String, model: String, baseUrl: String, timeout: Int) extends ImageGenerationConfig

Configuration for Stability AI API.

Configuration for Stability AI API.

Value parameters

apiKey

Your Stability AI API key. This is required for authentication.

baseUrl

Base URL for Stability AI API (default: https://api.stability.ai).

model

The engine/model ID to use (e.g., "stable-diffusion-xl-1024-v1-0", "stable-diffusion-v1-6").

timeout

Request timeout in milliseconds.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class StableDiffusionConfig(baseUrl: String, apiKey: Option[String], model: String, timeout: Int) extends ImageGenerationConfig

Configuration for Stable Diffusion

Configuration for Stable Diffusion

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class UnknownError(throwable: Throwable) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class UnsupportedOperation(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ValidationError(message: String) extends ImageGenerationError

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all