Class: RunApi::GrokImagine::Client

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

Overview

Grok-Imagine multimodal generation API client.

Examples:

client = RunApi::GrokImagine::Client.new(api_key: "your-api-key")
result = client.text_to_video.run(
  model: "grok-imagine-text-to-video",
  prompt: "A drone shot over a neon cityscape",
  resolution: "720p"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Client.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/runapi/grok_imagine/client.rb', line 28

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_video = Resources::TextToVideo.new(http)
  @image_to_video = Resources::ImageToVideo.new(http)
  @text_to_image = Resources::TextToImage.new(http)
  @image_to_image = Resources::ImageToImage.new(http)
  @extensions = Resources::Extensions.new(http)
  @upscales = Resources::Upscales.new(http)
end

Instance Attribute Details

#extensionsResources::Extensions (readonly)



24
25
26
# File 'lib/runapi/grok_imagine/client.rb', line 24

def extensions
  @extensions
end

#image_to_imageResources::ImageToImage (readonly)



22
23
24
# File 'lib/runapi/grok_imagine/client.rb', line 22

def image_to_image
  @image_to_image
end

#image_to_videoResources::ImageToVideo (readonly)



18
19
20
# File 'lib/runapi/grok_imagine/client.rb', line 18

def image_to_video
  @image_to_video
end

#text_to_imageResources::TextToImage (readonly)



20
21
22
# File 'lib/runapi/grok_imagine/client.rb', line 20

def text_to_image
  @text_to_image
end

#text_to_videoResources::TextToVideo (readonly)



16
17
18
# File 'lib/runapi/grok_imagine/client.rb', line 16

def text_to_video
  @text_to_video
end

#upscalesResources::Upscales (readonly)

Returns:



26
27
28
# File 'lib/runapi/grok_imagine/client.rb', line 26

def upscales
  @upscales
end