runapi-flux-2 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5fc862c9c9b7e20945a3e8c714a4385338ab39157df4f2bca9d9576b0e67f9c
4
- data.tar.gz: 58c1c05e82241145801f4c2d78720fd487c8d5cef7ea2cb9c6abae187c7df08c
3
+ metadata.gz: 5c62a0872a2952d047ff3263dc0def4d5b5db1c6f0c37126fc0299147453037b
4
+ data.tar.gz: da871e92d952eacff9d32c85bcd506795a7678a70e5978915e8bc60e84fe6bb7
5
5
  SHA512:
6
- metadata.gz: 5bc7816e95f93c880838f604b992a1cecd4fa8014fbe848e6c8181a47445055f63c43dc257cfe9caf17b90e399db5ec6fffaa0aec4f15024b6f94b2cebed45f0
7
- data.tar.gz: '0856bee6cebfd10be5691713841bea72b654a5f9068adb9cea1cd51bb46b61e1983a8a3f6254708b49ff2a2eae220c3ebaacd4b0971463a4276bf1cac5d52fbf'
6
+ metadata.gz: 61c06e5fdc27b9707af59dd39597f2b981406552c1e4167f0e84e5fba2c527cdbc6ba5da7e764a21afcd03b23dfd3fce8226505bf4260964a06ac503ae2010d8
7
+ data.tar.gz: 27a3aad268c8753021c6d99d13fb7c2e2e6ffd2d629280ae094627c1ce94ad968c69ac3cfebe1f695d7d42257520ebed0dfa2b89e89306a0bf7e06ff3c8f6bc9
data/README.md CHANGED
@@ -34,6 +34,8 @@ remix = client.remix_image.create(
34
34
 
35
35
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
36
36
 
37
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
38
+
37
39
  ## Language notes
38
40
 
39
41
  Use Ruby keyword arguments and the `RunApi::Flux2` error classes when building image jobs, Rails workers, or scripts. The available resources include `text_to_image` and `remix_image`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -2,22 +2,24 @@
2
2
 
3
3
  module RunApi
4
4
  module Flux2
5
- # Flux 2 text-to-image API client.
5
+ # Flux 2 text-to-image and remix API client.
6
+ #
7
+ # Pro and flex tiers for both text-to-image generation and
8
+ # text-guided image remixing.
6
9
  #
7
10
  # @example
8
11
  # client = RunApi::Flux2::Client.new(api_key: "your-api-key")
9
12
  # result = client.text_to_image.run(
10
13
  # model: "flux-2-pro-text-to-image", prompt: "A futuristic cityscape"
11
14
  # )
12
- class Client
13
- # @return [Resources::TextToImage] Text-to-image operations.
14
- attr_reader :text_to_image, :remix_image
15
+ class Client < RunApi::Core::Client
16
+ # @return [Resources::TextToImage] Text-to-image generation operations.
17
+ attr_reader :text_to_image
18
+ # @return [Resources::RemixImage] Image remix operations with text-guided transformations.
19
+ attr_reader :remix_image
15
20
 
16
21
  def initialize(api_key: nil, **options)
17
- @api_key = Core::Auth.resolve_api_key(api_key)
18
-
19
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
20
- http = client_options.http_client || Core::HttpClient.new(client_options)
22
+ super
21
23
  @text_to_image = Resources::TextToImage.new(http)
22
24
  @remix_image = Resources::RemixImage.new(http)
23
25
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Flux2
5
5
  module Resources
6
+ # Flux 2 image remix resource.
7
+ # Transform source images guided by a text prompt.
6
8
  class RemixImage
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module RunApi
4
4
  module Flux2
5
+ # Type definitions and constants for Flux 2.
6
+ # Each operation has pro (higher fidelity) and flex (faster, lower cost) tiers.
5
7
  module Types
6
8
  MODELS = %w[
7
9
  flux-2-pro-text-to-image flux-2-pro-remix-image
@@ -11,13 +13,16 @@ module RunApi
11
13
  REMIX_MODELS = %w[flux-2-pro-remix-image flux-2-flex-remix-image].freeze
12
14
 
13
15
  ASPECT_RATIOS = %w[1:1 4:3 3:4 16:9 9:16 3:2 2:3].freeze
16
+ # Remix adds 'auto' to preserve the source image aspect ratio.
14
17
  REMIX_ASPECT_RATIOS = %w[1:1 4:3 3:4 16:9 9:16 3:2 2:3 auto].freeze
15
18
  OUTPUT_RESOLUTIONS = %w[1k 2k].freeze
16
19
 
20
+ # A single generated image with its CDN URL.
17
21
  class Image < RunApi::Core::BaseModel
18
22
  optional :url, String
19
23
  end
20
24
 
25
+ # Generation result. +images+ is populated once +status+ is +"completed"+.
21
26
  class TextToImageResponse < RunApi::Core::TaskResponse
22
27
  required :id, String
23
28
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
@@ -32,9 +37,11 @@ module RunApi
32
37
  required :images, [-> { Image }]
33
38
  end
34
39
 
40
+ # Remix response -- same shape as generation.
35
41
  class RemixImageResponse < TextToImageResponse
36
42
  end
37
43
 
44
+ # Narrowed remix response from +run()+ where +images+ is guaranteed present.
38
45
  class CompletedRemixImageResponse < CompletedTextToImageResponse
39
46
  end
40
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-flux-2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.5
18
+ version: 0.2.6
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.5
25
+ version: 0.2.6
26
26
  description: The flux api Ruby SDK is the language-specific package for Flux 2 on
27
27
  RunAPI. Use this flux api package for text-to-image, remix-image, and creative production
28
28
  flows when your application needs JSON request bodies, task status lookup, and consistent