runapi-flux-2 0.2.7 → 0.3.0

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: 0d2f7af4be782a923b65df9f4f52418b1afa976271cca57a99931c313040b1ce
4
- data.tar.gz: 9f2e464857535f906008da2404a43c5183cc1c5e56cecf174eaedbeb54fff064
3
+ metadata.gz: c634d010d5d4744ce8e2811c5705149c620778591a7969c06e2227f463376b3b
4
+ data.tar.gz: 434c41db48cd75e99215be821afd491ef413c82c99f0f3dd81fdd310f994388f
5
5
  SHA512:
6
- metadata.gz: 3e4064be7f3a33af749e40c6ae7d0d3a0fadff165f50b97fa00e74f5122195a7f97fc8727a2f19896498c2502ab8ae9c8f3ce03ba23c381358c83f22f356a9c4
7
- data.tar.gz: 2b0450f7cb1d201d8978a9bcc7f42e4ca3756a07f4e146c6cb563bc1d688e6e246b9ee1490c2843e8566135202ce7bffea63eccfb8f7b4bbe25504ef22352a20
6
+ metadata.gz: 190af50f6f040b2e9931eca396f5ec886878fea787980f8432b92eb08b5f6ee115b9b5ee26ab96cc6857c21544d66204e1de3c0386d584f1e525bc7c1d5308b8
7
+ data.tar.gz: 6bbf2e9ec1837adc9d271a1e30d486259dd1538c807b712e850d7e8b8a79dc1dfd0d0d7e1597716c235335b7d7513f5b57adb77d740b52c27c0931470dbf10ec
data/README.md CHANGED
@@ -34,6 +34,10 @@ 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
+ ## Flux 2 Max
38
+
39
+ Use `flux-2-max-text-to-image` or `flux-2-max-remix-image` for the highest-quality tier. Max requires a concrete `aspect_ratio`, supports `output_resolution: "1k"` and `output_count: 1` only, and accepts exactly one public HTTP(S) source image for remix.
40
+
37
41
  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
42
 
39
43
  ## Language notes
@@ -4,64 +4,173 @@ module RunApi
4
4
  module Flux2
5
5
  CONTRACT = {
6
6
  "remix-image" => {
7
- "models" => ["flux-2-flex-remix-image", "flux-2-pro-remix-image"],
7
+ "models" => ["flux-2-flex-remix-image", "flux-2-max-remix-image", "flux-2-pro-remix-image"],
8
8
  "fields_by_model" => {
9
9
  "flux-2-flex-remix-image" => {
10
10
  "aspect_ratio" => {
11
11
  "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3", "auto"]
12
12
  },
13
+ "model" => {
14
+ "required" => true
15
+ },
13
16
  "output_resolution" => {
14
17
  "enum" => ["1k", "2k"]
15
18
  },
16
19
  "prompt" => {
17
- "required" => true
20
+ "required" => true,
21
+ "min" => 3,
22
+ "max" => 5000,
23
+ "length" => true
18
24
  },
19
25
  "source_image_urls" => {
26
+ "required" => true,
27
+ "min_items" => 1,
28
+ "max_items" => 8
29
+ }
30
+ },
31
+ "flux-2-max-remix-image" => {
32
+ "aspect_ratio" => {
33
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"],
34
+ "required" => true
35
+ },
36
+ "model" => {
20
37
  "required" => true
38
+ },
39
+ "output_count" => {
40
+ "enum" => [1],
41
+ "type" => "integer"
42
+ },
43
+ "output_resolution" => {
44
+ "enum" => ["1k"]
45
+ },
46
+ "prompt" => {
47
+ "required" => true,
48
+ "min" => 3,
49
+ "max" => 5000,
50
+ "length" => true
51
+ },
52
+ "source_image_urls" => {
53
+ "required" => true,
54
+ "min_items" => 1,
55
+ "max_items" => 1
21
56
  }
22
57
  },
23
58
  "flux-2-pro-remix-image" => {
24
59
  "aspect_ratio" => {
25
60
  "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3", "auto"]
26
61
  },
62
+ "model" => {
63
+ "required" => true
64
+ },
27
65
  "output_resolution" => {
28
66
  "enum" => ["1k", "2k"]
29
67
  },
30
68
  "prompt" => {
31
- "required" => true
69
+ "required" => true,
70
+ "min" => 3,
71
+ "max" => 5000,
72
+ "length" => true
32
73
  },
33
74
  "source_image_urls" => {
34
- "required" => true
75
+ "required" => true,
76
+ "min_items" => 1,
77
+ "max_items" => 8
35
78
  }
36
79
  }
37
- }
80
+ },
81
+ "rules" => [{
82
+ "when" => {
83
+ "model" => "flux-2-flex-remix-image"
84
+ },
85
+ "forbidden" => ["output_count"]
86
+ }, {
87
+ "when" => {
88
+ "model" => "flux-2-max-remix-image"
89
+ },
90
+ "forbidden" => ["enable_safety_checker"]
91
+ }, {
92
+ "when" => {
93
+ "model" => "flux-2-pro-remix-image"
94
+ },
95
+ "forbidden" => ["output_count"]
96
+ }]
38
97
  },
39
98
  "text-to-image" => {
40
- "models" => ["flux-2-flex-text-to-image", "flux-2-pro-text-to-image"],
99
+ "models" => ["flux-2-flex-text-to-image", "flux-2-max-text-to-image", "flux-2-pro-text-to-image"],
41
100
  "fields_by_model" => {
42
101
  "flux-2-flex-text-to-image" => {
43
102
  "aspect_ratio" => {
44
103
  "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"]
45
104
  },
105
+ "model" => {
106
+ "required" => true
107
+ },
46
108
  "output_resolution" => {
47
109
  "enum" => ["1k", "2k"]
48
110
  },
49
111
  "prompt" => {
112
+ "required" => true,
113
+ "min" => 3,
114
+ "max" => 5000,
115
+ "length" => true
116
+ }
117
+ },
118
+ "flux-2-max-text-to-image" => {
119
+ "aspect_ratio" => {
120
+ "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"],
50
121
  "required" => true
122
+ },
123
+ "model" => {
124
+ "required" => true
125
+ },
126
+ "output_count" => {
127
+ "enum" => [1],
128
+ "type" => "integer"
129
+ },
130
+ "output_resolution" => {
131
+ "enum" => ["1k"]
132
+ },
133
+ "prompt" => {
134
+ "required" => true,
135
+ "min" => 3,
136
+ "max" => 5000,
137
+ "length" => true
51
138
  }
52
139
  },
53
140
  "flux-2-pro-text-to-image" => {
54
141
  "aspect_ratio" => {
55
142
  "enum" => ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"]
56
143
  },
144
+ "model" => {
145
+ "required" => true
146
+ },
57
147
  "output_resolution" => {
58
148
  "enum" => ["1k", "2k"]
59
149
  },
60
150
  "prompt" => {
61
- "required" => true
151
+ "required" => true,
152
+ "min" => 3,
153
+ "max" => 5000,
154
+ "length" => true
62
155
  }
63
156
  }
64
- }
157
+ },
158
+ "rules" => [{
159
+ "when" => {
160
+ "model" => "flux-2-flex-text-to-image"
161
+ },
162
+ "forbidden" => ["output_count"]
163
+ }, {
164
+ "when" => {
165
+ "model" => "flux-2-max-text-to-image"
166
+ },
167
+ "forbidden" => ["enable_safety_checker"]
168
+ }, {
169
+ "when" => {
170
+ "model" => "flux-2-pro-text-to-image"
171
+ },
172
+ "forbidden" => ["output_count"]
173
+ }]
65
174
  }
66
175
  }.freeze
67
176
  end
@@ -17,19 +17,19 @@ module RunApi
17
17
  @http = http
18
18
  end
19
19
 
20
- def run(**params)
21
- task = create(**params)
22
- poll_until_complete { get(task.id) }
20
+ def run(options: nil, **params)
21
+ task = create(options: options, **params)
22
+ poll_until_complete { get(task.id, options: options) }
23
23
  end
24
24
 
25
- def create(**params)
25
+ def create(options: nil, **params)
26
26
  params = compact_params(params)
27
27
  validate_contract!(CONTRACT["remix-image"], params)
28
- request(:post, ENDPOINT, body: params)
28
+ request(:post, ENDPOINT, body: params, options: options)
29
29
  end
30
30
 
31
- def get(id)
32
- request(:get, "#{ENDPOINT}/#{id}")
31
+ def get(id, options: nil)
32
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
33
33
  end
34
34
  end
35
35
  end
@@ -21,27 +21,27 @@ module RunApi
21
21
  #
22
22
  # @param params [Hash] text-to-image parameters
23
23
  # @return [RunApi::Flux2::Types::CompletedTextToImageResponse] completed text-to-image result
24
- def run(**params)
25
- task = create(**params)
26
- poll_until_complete { get(task.id) }
24
+ def run(options: nil, **params)
25
+ task = create(options: options, **params)
26
+ poll_until_complete { get(task.id, options: options) }
27
27
  end
28
28
 
29
29
  # Create a text-to-image task.
30
30
  #
31
31
  # @param params [Hash] text-to-image parameters
32
32
  # @return [RunApi::Flux2::Types::TextToImageResponse] task creation result with id
33
- def create(**params)
33
+ def create(options: nil, **params)
34
34
  params = compact_params(params)
35
35
  validate_contract!(CONTRACT["text-to-image"], params)
36
- request(:post, ENDPOINT, body: params)
36
+ request(:post, ENDPOINT, body: params, options: options)
37
37
  end
38
38
 
39
39
  # Get text-to-image status by task ID.
40
40
  #
41
41
  # @param id [String] task ID
42
42
  # @return [RunApi::Flux2::Types::TextToImageResponse] current text-to-image status
43
- def get(id)
44
- request(:get, "#{ENDPOINT}/#{id}")
43
+ def get(id, options: nil)
44
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
45
45
  end
46
46
  end
47
47
  end
@@ -3,7 +3,8 @@
3
3
  module RunApi
4
4
  module Flux2
5
5
  # Type definitions for Flux 2.
6
- # Each operation has pro (higher fidelity) and flex (faster, lower cost) tiers.
6
+ # Each operation has Pro, Flex, and Max tiers. Max requires a concrete
7
+ # aspect ratio, supports 1k output only, and produces one image.
7
8
  module Types
8
9
  # A single generated image with its CDN URL.
9
10
  class Image < RunApi::Core::BaseModel
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.7
4
+ version: 0.3.0
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.7
18
+ version: 0.3.0
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.7
25
+ version: 0.3.0
26
26
  description: The Flux 2 Ruby SDK is the language-specific package for Flux 2 on RunAPI.
27
27
  Use this package for image generation, image editing, and creative production workflows
28
28
  when your application needs request bodies, task status lookup, and consistent RunAPI
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 4.0.10
70
+ rubygems_version: 4.0.17
71
71
  specification_version: 4
72
72
  summary: Flux 2 API Ruby SDK for RunAPI
73
73
  test_files: []