Class: RunApi::FluxKontext::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/runapi/flux_kontext/client.rb

Overview

Flux Kontext image generation API client.

Examples:

client = RunApi::FluxKontext::Client.new(api_key: "your-api-key")
result = client.text_to_image.run(
  model: "flux-kontext-pro", prompt: "A futuristic cityscape"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Client.



16
17
18
19
20
21
22
# File 'lib/runapi/flux_kontext/client.rb', line 16

def initialize(api_key: nil, **options)
  @api_key = Core::Auth.resolve_api_key(api_key)

  client_options = Core::ClientOptions.new(api_key: @api_key, **options)
  http = client_options.http_client || Core::HttpClient.new(client_options)
  @text_to_image = Resources::TextToImage.new(http)
end

Instance Attribute Details

#text_to_imageResources::TextToImage (readonly)

Returns Image generation operations.

Returns:



14
15
16
# File 'lib/runapi/flux_kontext/client.rb', line 14

def text_to_image
  @text_to_image
end