org.llm4s.imagegeneration
Members list
Packages
Type members
Classlikes
Represents a generated image
Represents a generated image
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
HealthStatus.type
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. Defaults to a higher value suitable for cloud APIs.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ImageGenerationConfigclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Options for image editing
Options for image editing
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImageGeneration.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Why an image generation call failed.
Why an image generation call failed.
An org.llm4s.error.LLMError, so the client methods can return org.llm4s.error.CancelledError when their thread is interrupted - the contract of every llm4s client - next to these cases: they return Either[LLMError, _].
Every case says whether trying again can help, with a marker: LLMError.isRecoverable (and the retry policies built on it) is true only for a org.llm4s.error.RecoverableError, and every other case is a org.llm4s.error.NonRecoverableError. Recoverable: ImageRateLimitError, and an ImageServiceError whose status is transient (see ImageServiceError.isTransientStatus). Everything else is not: a rejected credential, request or prompt gets the same answer on the next call, and an ImageUnknownError is not retried blindly.
The cases that would share a name with an org.llm4s.error type carry an Image prefix (ImageAuthenticationError, ImageRateLimitError, ImageServiceError, ImageValidationError, ImageUnknownError): both families are LLMErrors, so a match on the wrong one would compile and never fire.
Attributes
- Supertypes
-
trait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class ImageAuthenticationErrorclass ImageRateLimitErrortrait ImageServiceErrorclass ImageUnknownErrorclass ImageValidationErrorclass InvalidPromptErrorclass UnsupportedOperationShow all
Options for image generation
Options for image generation
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Providers for image generation
Providers for image generation
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass 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:
- OpenAI: https://openai.com/api/pricing/
- Stability AI: https://platform.stability.ai/pricing
Attributes
- See also
-
org.llm4s.model.ModelPricing for LLM token-based pricing
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImagePricingRegistry.type
Attributes
- Supertypes
-
trait RecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The provider's service failed or refused the call, with the HTTP status it answered (0 when it did not answer at all, as in a failed health check).
The provider's service failed or refused the call, with the HTTP status it answered (0 when it did not answer at all, as in a failed health check).
Whether trying again can help follows from the status, which a class cannot express by itself, so there are two cases behind this type and ImageServiceError.apply picks one: a transient status gives a org.llm4s.error.RecoverableError, any other a org.llm4s.error.NonRecoverableError. Build it with ImageServiceError(message, status) and match it with case ImageServiceError(message, status).
Attributes
- Companion
- object
- Supertypes
-
trait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ImageServiceError.type
Image size enumeration
Image size enumeration
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Autoclass Customobject Landscape1536x1024object Landscape768x512object Portrait1024x1536object Portrait512x768object Square1024object Square512Show all
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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:
observeImageGenerationfor every generate/edit call (success or failure)recordImageGenerationCostwhen pricing is available via ImagePricingRegistryTraceEvent.ImageGenerationCompletedfor 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
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ImageGenerationConfigclass Objecttrait Matchableclass AnyShow all
Provider-specific edit options; keeps shared API provider-agnostic.
Provider-specific edit options; keeps shared API provider-agnostic.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class OpenAIclass StableDiffusion
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
An ImageServiceError the provider refused for good: the same call gets the same answer.
An ImageServiceError the provider refused for good: the same call gets the same answer.
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageServiceErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents the status of the image generation service
Represents the status of the image generation service
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ImageGenerationConfigclass Objecttrait Matchableclass AnyShow all
Configuration for Stable Diffusion
Configuration for Stable Diffusion
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ImageGenerationConfigclass Objecttrait Matchableclass AnyShow all
An ImageServiceError with a transient status: trying again can help.
An ImageServiceError with a transient status: trying again can help.
Attributes
- Supertypes
-
trait RecoverableErrortrait ImageServiceErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait NonRecoverableErrortrait ImageGenerationErrortrait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all