runapi-grok-imagine 0.2.15 → 0.2.16

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: 9977ae570c6a5ffe4608e156f1f8f752a5ef8f1ad3153eb9995d50d8544d072c
4
- data.tar.gz: 6e860ff0abebbbc3afca07b44df6eeb24bbef7ca3138470d1fc13d3448bf0f5c
3
+ metadata.gz: 2412da27da9fdbe2b64e75e625496bcfc0ca3ee20b725139e70397201b2f8b28
4
+ data.tar.gz: d691869681c3af4c284d4c26a16479126f518c34646d56958c853506f12e2811
5
5
  SHA512:
6
- metadata.gz: 88353615d590fe3779b74fd8d13afcc8fbe41037f390bbb4dd60c8a1de343af0d72179723886f0178adcca1f5755ce63b05209b145d44bd7f32676b45268fcf2
7
- data.tar.gz: 745f3f6e1af60ef8a3d273cf09e87586028cfe7a6d1d257a6fe9cc064f86d0b2edcccf06cfc12dbe178b726d7234c4087dcb9bd09beae78a4beee7d6bd2bf0e8
6
+ metadata.gz: 1ccf097c1e1b376bad6344a545b3c8280c913e65ae2eec4e5b933605105573e07edd60647c81d3655302fbdbf22b75eb69de6c71640b9fe2ffcb40d40ff47987
7
+ data.tar.gz: 4e8d3b221374ca657257eb396d482bc3d1c88b0fb642e671ae67f7dc05231f4f088c37ed592d78a878a2c638bc064a6fac51c7ffdce90cdd2db39d599a1784c9
data/README.md CHANGED
@@ -22,6 +22,19 @@ task = client.text_to_video.create(
22
22
  status = client.text_to_video.get(task.id)
23
23
  ```
24
24
 
25
+ ## Edit with Image 2.0
26
+
27
+ Image 2.0 edits one to five source images directly. Provide the source URLs and output aspect ratio; the edit prompt is optional. The task-based `source_task_id` and `mask_indices` fields are no longer accepted by this request.
28
+
29
+ ```ruby
30
+ edit = client.edit_image.create(
31
+ model: "grok-imagine-image-2-0",
32
+ source_image_urls: ["https://cdn.runapi.ai/public/samples/input.png"],
33
+ aspect_ratio: "1:1",
34
+ prompt: "Change the background to a sunset beach"
35
+ )
36
+ ```
37
+
25
38
  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.
26
39
 
27
40
  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.
@@ -39,7 +52,6 @@ Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when buil
39
52
  - Video 1.5 Fast pricing and rate limits: https://runapi.ai/models/grok-imagine/video-1.5-fast
40
53
  - Text-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/text-to-video
41
54
  - Image-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/image-to-video
42
- - Provider comparison: https://runapi.ai/providers/xai
43
55
  - Full catalog: https://runapi.ai/models
44
56
  - Repository: https://github.com/runapi-ai/grok-imagine-sdk
45
57
 
@@ -15,17 +15,21 @@ module RunApi
15
15
  }
16
16
  },
17
17
  "grok-imagine-image-2-0" => {
18
- "mask_indices" => {
19
- "min_items" => 1
18
+ "aspect_ratio" => {
19
+ "enum" => ["1:1", "2:3", "3:2", "16:9", "9:16", "auto"],
20
+ "required" => true
20
21
  },
21
22
  "model" => {
22
23
  "required" => true
23
24
  },
24
25
  "prompt" => {
25
- "required" => true
26
+ "max" => 390000,
27
+ "length" => true
26
28
  },
27
- "source_task_id" => {
28
- "required" => true
29
+ "source_image_urls" => {
30
+ "required" => true,
31
+ "min_items" => 1,
32
+ "max_items" => 5
29
33
  }
30
34
  }
31
35
  },
@@ -33,12 +37,12 @@ module RunApi
33
37
  "when" => {
34
38
  "model" => "grok-imagine-edit-image"
35
39
  },
36
- "forbidden" => ["source_task_id", "mask_indices"]
40
+ "forbidden" => ["source_task_id", "mask_indices", "source_image_urls", "aspect_ratio"]
37
41
  }, {
38
42
  "when" => {
39
43
  "model" => "grok-imagine-image-2-0"
40
44
  },
41
- "forbidden" => ["source_image_url", "enable_safety_checker"]
45
+ "forbidden" => ["source_image_url", "source_task_id", "mask_indices", "enable_safety_checker"]
42
46
  }]
43
47
  },
44
48
  "extend" => {
@@ -177,12 +181,26 @@ module RunApi
177
181
  "grok-imagine-image-2-0" => {
178
182
  "model" => {
179
183
  "required" => true
180
- },
181
- "source_task_id" => {
182
- "required" => true
183
184
  }
184
185
  }
185
- }
186
+ },
187
+ "rules" => [{
188
+ "required_any" => ["image_url", "source_task_id"]
189
+ }, {
190
+ "when" => {
191
+ "image_url" => {
192
+ "present" => true
193
+ }
194
+ },
195
+ "forbidden" => ["source_task_id"]
196
+ }, {
197
+ "when" => {
198
+ "source_task_id" => {
199
+ "present" => true
200
+ }
201
+ },
202
+ "forbidden" => ["image_url"]
203
+ }]
186
204
  },
187
205
  "text-to-image" => {
188
206
  "models" => ["grok-imagine-image-2-0", "grok-imagine-text-to-image"],
@@ -3,7 +3,11 @@
3
3
  module RunApi
4
4
  module GrokImagine
5
5
  module Resources
6
- # Grok-Imagine prompt-guided image editing resource.
6
+ # Prompt-guided image editing resource.
7
+ #
8
+ # Image 2.0 accepts one to five source_image_urls, an aspect_ratio, and
9
+ # an optional prompt. The original model continues to accept a single
10
+ # source_image_url and prompt.
7
11
  class EditImage
8
12
  include RunApi::Core::ResourceHelpers
9
13
 
@@ -3,7 +3,8 @@
3
3
  module RunApi
4
4
  module GrokImagine
5
5
  module Resources
6
- # Produces an editable segmentation map from an Image 2.0 text-to-image task.
6
+ # Produces an editable segmentation map from a public image URL.
7
+ # source_task_id remains accepted as a compatibility input; use image_url instead.
7
8
  class SegmentMap
8
9
  include RunApi::Core::ResourceHelpers
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-grok-imagine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
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.4.0
18
+ version: 0.4.1
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.4.0
25
+ version: 0.4.1
26
26
  description: The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine
27
27
  on RunAPI. Use this package for image and video generation, image editing, and creative
28
28
  production workflows when your application needs request bodies, task status lookup,