This client connects to OpenAI's DALL-E API for text-to-image generation. It supports both DALL-E 2 and DALL-E 3 models with their respective capabilities and limitations.
Value parameters
config
Configuration containing API key, model selection, and timeout settings
Attributes
Example
val config = OpenAIConfig(
apiKey = "your-openai-api-key",
model = "dall-e-2" // or "dall-e-3"
)
val client = new OpenAIImageClient(config)
val options = ImageGenerationOptions(
size = ImageSize.Square1024,
format = ImageFormat.PNG
)
client.generateImage("a beautiful landscape", options) match {
case Right(image) => println(s"Generated image: $${image.size}")
case Left(error) => println(s"Error: $${error.message}")
}