Class: RunApi::Gpt4oImage::Client

Inherits:
Core::Client
  • Object
show all
Defined in:
lib/runapi/gpt_4o_image/client.rb

Overview

GPT-4o Image generation and editing API client.

Supports pure text-to-image generation, image editing with source images, and inpainting with an optional mask.

Examples:

client = RunApi::Gpt4oImage::Client.new(api_key: "your-api-key")

# Pure generation
result = client.text_to_image.run(
  model: "gpt-4o-image", prompt: "A mountain lake at dawn",
  aspect_ratio: "3:2"
)

# Edit with source images
edited = client.text_to_image.run(
  model: "gpt-4o-image", prompt: "Add a rainbow",
  aspect_ratio: "3:2",
  source_image_urls: ["https://example.com/photo.jpg"]
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



29
30
31
32
# File 'lib/runapi/gpt_4o_image/client.rb', line 29

def initialize(api_key: nil, **options)
  super
  @text_to_image = Resources::TextToImage.new(http)
end

Instance Attribute Details

#text_to_imageResources::TextToImage (readonly)

Returns Image generation and editing operations.

Returns:



27
28
29
# File 'lib/runapi/gpt_4o_image/client.rb', line 27

def text_to_image
  @text_to_image
end