Image

class pipecat.services.openai.image.OpenAIImageGenService(*, api_key, base_url=None, aiohttp_session, image_size, model='dall-e-3')[source]

Bases: ImageGenService

Parameters:
  • api_key (str)

  • base_url (str | None)

  • aiohttp_session (ClientSession)

  • image_size (Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792'])

  • model (str)

async run_image_gen(prompt)[source]

Generate an image from a text prompt.

This method must be implemented by subclasses to provide actual image generation functionality using their specific AI service.

Parameters:

prompt (str) – The text prompt to generate an image from.

Yields:

Frame

Frames containing the generated image (typically ImageRawFrame

or URLImageRawFrame).

Return type:

AsyncGenerator[Frame, None]