Class: RunApi::Kling::Client

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

Overview

Kling video generation API client.

Examples:

client = RunApi::Kling::Client.new(api_key: "your-api-key")
result = client.text_to_video.run(
  model: "kling-3.0", prompt: "A cat walking through a garden"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Client.



22
23
24
25
26
27
28
29
30
31
# File 'lib/runapi/kling/client.rb', line 22

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)
  @ai_avatar = Resources::AiAvatar.new(http)
  @image_to_video = Resources::ImageToVideo.new(http)
  @motion_control = Resources::MotionControl.new(http)
end

Instance Attribute Details

#ai_avatarResources::AiAvatar (readonly)

Returns AI avatar generation operations.

Returns:



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

def ai_avatar
  @ai_avatar
end

#image_to_videoResources::ImageToVideo (readonly)

Returns Image-to-video operations.

Returns:



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

def image_to_video
  @image_to_video
end

#motion_controlResources::MotionControl (readonly)

Returns Motion control operations.

Returns:



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

def motion_control
  @motion_control
end

#text_to_videoResources::TextToVideo (readonly)

Returns Text-to-video operations.

Returns:



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

def text_to_video
  @text_to_video
end