runapi-grok-imagine 0.2.8 → 0.2.9

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: f1e3242748745f800a98bf97daa49bf3a9257e8cd789fd7ad641bc43bd56e864
4
- data.tar.gz: 639d984e396f8ca06f774e7e52750b0ec7d23db588ec7670495673ffce3adb14
3
+ metadata.gz: 52bf921738a8782baf0e96db9dca31a022002cf2c6cb7f3e531e167a6762b9ed
4
+ data.tar.gz: 795c796bf56361b2e9d12b527ec864128a1080e4d250c1b31087f5f397480825
5
5
  SHA512:
6
- metadata.gz: cc1472f349ac8211430c488460c74d5b1254069e39006247cdedc94975d86cd48d4fa6098883f876d5b9593b75c1dfbd665fd02bd2e2a237b5bd06722cc032e3
7
- data.tar.gz: 0dc17d476484b3957c40ec0be32f9ad4c667ee07dd7103630bea6bb5ab8aa592624addf3ba7fbc27ff77834f1dafafd0f526d5fefe53b7786892a7d07b586564
6
+ metadata.gz: ad5eb5d48c9dc6b138bf8ee8015fc49f5524c950e299813aa320af9d884f41fa9acecac9c9e4c6475667dd5a3a517aaf0f376864dc06d98637f47529393f63a0
7
+ data.tar.gz: abf3c13c706bef9faaa63a17a8546b0bc6b0c8cf63034b3204c3df1ae4f77693320787a91bd4d88a483e5cd233d628f6e95df083366752efcb68c4d6ca7ba3b5
data/README.md CHANGED
@@ -28,7 +28,7 @@ RunAPI-generated file URLs are temporary. Download and store generated images, v
28
28
 
29
29
  ## Language notes
30
30
 
31
- Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when building media jobs, Rails workers, or scripts. The available resources are `text_to_video`, `image_to_video`, `text_to_image`, `edit_image`, `extensions`, and `upscales`; use `grok-imagine-video-1.5-preview` with either video resource for the preview model. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
31
+ Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when building media jobs, Rails workers, or scripts. The available resources are `text_to_video`, `image_to_video`, `text_to_image`, `edit_image`, `extensions`, and `upscales`; use `grok-imagine-video-1.5-fast` or `grok-imagine-video-1.5-preview` with either video resource. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
32
32
 
33
33
  ## Links
34
34
 
@@ -36,6 +36,7 @@ Use Ruby keyword arguments and the `RunApi::GrokImagine` error classes when buil
36
36
  - SDK docs: https://runapi.ai/docs#sdk-grok-imagine
37
37
  - Product docs: https://runapi.ai/docs#grok-imagine
38
38
  - Video 1.5 Preview pricing and rate limits: https://runapi.ai/models/grok-imagine/video-1.5-preview
39
+ - Video 1.5 Fast pricing and rate limits: https://runapi.ai/models/grok-imagine/video-1.5-fast
39
40
  - Text-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/text-to-video
40
41
  - Image-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/image-to-video
41
42
  - Provider comparison: https://runapi.ai/providers/xai
@@ -28,7 +28,7 @@ module RunApi
28
28
  }
29
29
  },
30
30
  "image-to-video" => {
31
- "models" => ["grok-imagine-image-to-video", "grok-imagine-video-1.5-preview"],
31
+ "models" => ["grok-imagine-image-to-video", "grok-imagine-video-1.5-fast", "grok-imagine-video-1.5-preview"],
32
32
  "fields_by_model" => {
33
33
  "grok-imagine-image-to-video" => {
34
34
  "aspect_ratio" => {
@@ -47,6 +47,25 @@ module RunApi
47
47
  "enum" => ["480p", "720p"]
48
48
  }
49
49
  },
50
+ "grok-imagine-video-1.5-fast" => {
51
+ "aspect_ratio" => {
52
+ "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3"]
53
+ },
54
+ "duration_seconds" => {
55
+ "min" => 1,
56
+ "max" => 30,
57
+ "type" => "integer"
58
+ },
59
+ "index" => {
60
+ "type" => "integer"
61
+ },
62
+ "output_resolution" => {
63
+ "enum" => ["480p", "720p"]
64
+ },
65
+ "source_image_urls" => {
66
+ "required" => true
67
+ }
68
+ },
50
69
  "grok-imagine-video-1.5-preview" => {
51
70
  "aspect_ratio" => {
52
71
  "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
@@ -74,9 +93,19 @@ module RunApi
74
93
  },
75
94
  "rules" => [{
76
95
  "when" => {
77
- "model" => "grok-imagine-video-1.5-preview"
96
+ "model" => "grok-imagine-image-to-video"
97
+ },
98
+ "forbidden" => ["reference_image_urls"]
99
+ }, {
100
+ "when" => {
101
+ "model" => "grok-imagine-video-1.5-fast"
78
102
  },
79
103
  "forbidden" => ["source_task_id", "index", "motion_style", "enable_safety_checker"]
104
+ }, {
105
+ "when" => {
106
+ "model" => "grok-imagine-video-1.5-preview"
107
+ },
108
+ "forbidden" => ["source_task_id", "index", "reference_image_urls", "motion_style", "enable_safety_checker"]
80
109
  }]
81
110
  },
82
111
  "text-to-image" => {
@@ -90,7 +119,7 @@ module RunApi
90
119
  }
91
120
  },
92
121
  "text-to-video" => {
93
- "models" => ["grok-imagine-text-to-video", "grok-imagine-video-1.5-preview"],
122
+ "models" => ["grok-imagine-text-to-video", "grok-imagine-video-1.5-fast", "grok-imagine-video-1.5-preview"],
94
123
  "fields_by_model" => {
95
124
  "grok-imagine-text-to-video" => {
96
125
  "aspect_ratio" => {
@@ -106,6 +135,22 @@ module RunApi
106
135
  "enum" => ["480p", "720p"]
107
136
  }
108
137
  },
138
+ "grok-imagine-video-1.5-fast" => {
139
+ "aspect_ratio" => {
140
+ "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3"]
141
+ },
142
+ "duration_seconds" => {
143
+ "min" => 1,
144
+ "max" => 30,
145
+ "type" => "integer"
146
+ },
147
+ "output_resolution" => {
148
+ "enum" => ["480p", "720p"]
149
+ },
150
+ "prompt" => {
151
+ "required" => true
152
+ }
153
+ },
109
154
  "grok-imagine-video-1.5-preview" => {
110
155
  "aspect_ratio" => {
111
156
  "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
@@ -128,9 +173,19 @@ module RunApi
128
173
  },
129
174
  "rules" => [{
130
175
  "when" => {
131
- "model" => "grok-imagine-video-1.5-preview"
176
+ "model" => "grok-imagine-text-to-video"
177
+ },
178
+ "forbidden" => ["reference_image_urls"]
179
+ }, {
180
+ "when" => {
181
+ "model" => "grok-imagine-video-1.5-fast"
132
182
  },
133
183
  "forbidden" => ["motion_style", "enable_safety_checker"]
184
+ }, {
185
+ "when" => {
186
+ "model" => "grok-imagine-video-1.5-preview"
187
+ },
188
+ "forbidden" => ["reference_image_urls", "motion_style", "enable_safety_checker"]
134
189
  }]
135
190
  },
136
191
  "upscale-image" => {
@@ -40,7 +40,14 @@ module RunApi
40
40
  duration_seconds = param(params, :duration_seconds)
41
41
  if duration_seconds
42
42
  int = duration_seconds.to_i
43
- range = (param(params, :model) == Types::PREVIEW_MODEL) ? Types::PREVIEW_DURATION_RANGE : Types::DURATION_RANGE
43
+ range = case param(params, :model)
44
+ when Types::FAST_MODEL
45
+ Types::FAST_DURATION_RANGE
46
+ when Types::PREVIEW_MODEL
47
+ Types::PREVIEW_DURATION_RANGE
48
+ else
49
+ Types::DURATION_RANGE
50
+ end
44
51
  unless range.cover?(int)
45
52
  raise Core::ValidationError, "duration_seconds must be an integer between #{range.min} and #{range.max}"
46
53
  end
@@ -4,6 +4,8 @@ module RunApi
4
4
  module GrokImagine
5
5
  module Types
6
6
  DURATION_RANGE = (6..30)
7
+ FAST_MODEL = "grok-imagine-video-1.5-fast"
8
+ FAST_DURATION_RANGE = (1..30)
7
9
  PREVIEW_MODEL = "grok-imagine-video-1.5-preview"
8
10
  PREVIEW_DURATION_RANGE = (1..15)
9
11
  EXTENSION_DURATION_SECONDS = [6, 10].freeze
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.8
4
+ version: 0.2.9
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.11
18
+ version: 0.2.12
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.11
25
+ version: 0.2.12
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,