runapi-grok-imagine 0.2.7 → 0.2.8

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: a703110005c79f1716e346be1519250ff551ed318541f6e15ce6fcefc42760a7
4
- data.tar.gz: 113a1d0c4ab22449c4ac45fa29ba112d66168a30f6675bff3f519c74c50c2fe7
3
+ metadata.gz: f1e3242748745f800a98bf97daa49bf3a9257e8cd789fd7ad641bc43bd56e864
4
+ data.tar.gz: 639d984e396f8ca06f774e7e52750b0ec7d23db588ec7670495673ffce3adb14
5
5
  SHA512:
6
- metadata.gz: 7a63c2a781705df2d2d15ce033657e2616c52ebe53d33b19cdda954363e7ab6f40e660bfabc0cb09a47ebf1c8e06929ae1ba7a3e686b12430a10914734f72d39
7
- data.tar.gz: f915d1a24f8e31aa0551e817710e8fa679e380105c084c8ed1b8554b024290bf88e176614a4d881b33d425910a4918e10857cca78eb09c69aeb75ac952bdc8ab
6
+ metadata.gz: cc1472f349ac8211430c488460c74d5b1254069e39006247cdedc94975d86cd48d4fa6098883f876d5b9593b75c1dfbd665fd02bd2e2a237b5bd06722cc032e3
7
+ data.tar.gz: 0dc17d476484b3957c40ec0be32f9ad4c667ee07dd7103630bea6bb5ab8aa592624addf3ba7fbc27ff77834f1dafafd0f526d5fefe53b7786892a7d07b586564
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Grok Imagine Ruby SDK for RunAPI
2
2
 
3
- The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine on RunAPI. Use this package for image generation, image editing, and creative production workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
3
+ The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine on RunAPI. Use this package for image and video generation, image editing, and creative production workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
4
4
 
5
5
  This README is the Ruby package guide inside the public `grok-imagine-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/grok-imagine; for API reference, use https://runapi.ai/docs#grok-imagine; for SDK docs, use https://runapi.ai/docs#sdk-grok-imagine.
6
6
 
@@ -13,7 +13,7 @@ gem install runapi-grok-imagine
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-grok-imagine"
16
+ require "runapi/grok_imagine"
17
17
 
18
18
  client = RunApi::GrokImagine::Client.new
19
19
  task = client.text_to_video.create(
@@ -28,14 +28,16 @@ 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 image jobs, Rails workers, or scripts. The available resources are `text_to_video`, `image_to_video`, `text_to_image`, `edit_image`, `extensions`, and `upscales`. 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-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.
32
32
 
33
33
  ## Links
34
34
 
35
35
  - Model page: https://runapi.ai/models/grok-imagine
36
36
  - SDK docs: https://runapi.ai/docs#sdk-grok-imagine
37
37
  - Product docs: https://runapi.ai/docs#grok-imagine
38
- - Pricing and rate limits: https://runapi.ai/models/grok-imagine/text-to-video
38
+ - Video 1.5 Preview pricing and rate limits: https://runapi.ai/models/grok-imagine/video-1.5-preview
39
+ - Text-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/text-to-video
40
+ - Image-to-video pricing and rate limits: https://runapi.ai/models/grok-imagine/image-to-video
39
41
  - Provider comparison: https://runapi.ai/providers/xai
40
42
  - Full catalog: https://runapi.ai/models
41
43
  - Repository: https://github.com/runapi-ai/grok-imagine-sdk
@@ -28,7 +28,7 @@ module RunApi
28
28
  }
29
29
  },
30
30
  "image-to-video" => {
31
- "models" => ["grok-imagine-image-to-video"],
31
+ "models" => ["grok-imagine-image-to-video", "grok-imagine-video-1.5-preview"],
32
32
  "fields_by_model" => {
33
33
  "grok-imagine-image-to-video" => {
34
34
  "aspect_ratio" => {
@@ -46,8 +46,38 @@ module RunApi
46
46
  "output_resolution" => {
47
47
  "enum" => ["480p", "720p"]
48
48
  }
49
+ },
50
+ "grok-imagine-video-1.5-preview" => {
51
+ "aspect_ratio" => {
52
+ "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
53
+ },
54
+ "duration_seconds" => {
55
+ "min" => 1,
56
+ "max" => 15,
57
+ "type" => "integer"
58
+ },
59
+ "index" => {
60
+ "type" => "integer"
61
+ },
62
+ "output_resolution" => {
63
+ "enum" => ["480p", "720p"]
64
+ },
65
+ "prompt" => {
66
+ "min" => 1,
67
+ "max" => 4096,
68
+ "length" => true
69
+ },
70
+ "source_image_urls" => {
71
+ "required" => true
72
+ }
49
73
  }
50
- }
74
+ },
75
+ "rules" => [{
76
+ "when" => {
77
+ "model" => "grok-imagine-video-1.5-preview"
78
+ },
79
+ "forbidden" => ["source_task_id", "index", "motion_style", "enable_safety_checker"]
80
+ }]
51
81
  },
52
82
  "text-to-image" => {
53
83
  "models" => ["grok-imagine-text-to-image"],
@@ -60,7 +90,7 @@ module RunApi
60
90
  }
61
91
  },
62
92
  "text-to-video" => {
63
- "models" => ["grok-imagine-text-to-video"],
93
+ "models" => ["grok-imagine-text-to-video", "grok-imagine-video-1.5-preview"],
64
94
  "fields_by_model" => {
65
95
  "grok-imagine-text-to-video" => {
66
96
  "aspect_ratio" => {
@@ -75,8 +105,33 @@ module RunApi
75
105
  "output_resolution" => {
76
106
  "enum" => ["480p", "720p"]
77
107
  }
108
+ },
109
+ "grok-imagine-video-1.5-preview" => {
110
+ "aspect_ratio" => {
111
+ "enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
112
+ },
113
+ "duration_seconds" => {
114
+ "min" => 1,
115
+ "max" => 15,
116
+ "type" => "integer"
117
+ },
118
+ "output_resolution" => {
119
+ "enum" => ["480p", "720p"]
120
+ },
121
+ "prompt" => {
122
+ "required" => true,
123
+ "min" => 1,
124
+ "max" => 4096,
125
+ "length" => true
126
+ }
78
127
  }
79
- }
128
+ },
129
+ "rules" => [{
130
+ "when" => {
131
+ "model" => "grok-imagine-video-1.5-preview"
132
+ },
133
+ "forbidden" => ["motion_style", "enable_safety_checker"]
134
+ }]
80
135
  },
81
136
  "upscale-image" => {
82
137
  "models" => [],
@@ -16,19 +16,19 @@ module RunApi
16
16
  @http = http
17
17
  end
18
18
 
19
- def run(**params)
20
- task = create(**params)
21
- poll_until_complete { get(task.id) }
19
+ def run(options: nil, **params)
20
+ task = create(options: options, **params)
21
+ poll_until_complete { get(task.id, options: options) }
22
22
  end
23
23
 
24
- def create(**params)
24
+ def create(options: nil, **params)
25
25
  params = compact_params(params)
26
26
  validate_params!(params)
27
- request(:post, ENDPOINT, body: params)
27
+ request(:post, ENDPOINT, body: params, options: options)
28
28
  end
29
29
 
30
- def get(id)
31
- request(:get, "#{ENDPOINT}/#{id}")
30
+ def get(id, options: nil)
31
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
32
32
  end
33
33
 
34
34
  private
@@ -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_params!(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
 
35
35
  private
@@ -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_params!(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
 
35
35
  private
@@ -16,19 +16,19 @@ module RunApi
16
16
  @http = http
17
17
  end
18
18
 
19
- def run(**params)
20
- task = create(**params)
21
- poll_until_complete { get(task.id) }
19
+ def run(options: nil, **params)
20
+ task = create(options: options, **params)
21
+ poll_until_complete { get(task.id, options: options) }
22
22
  end
23
23
 
24
- def create(**params)
24
+ def create(options: nil, **params)
25
25
  params = compact_params(params)
26
26
  validate_params!(params)
27
- request(:post, ENDPOINT, body: params)
27
+ request(:post, ENDPOINT, body: params, options: options)
28
28
  end
29
29
 
30
- def get(id)
31
- request(:get, "#{ENDPOINT}/#{id}")
30
+ def get(id, options: nil)
31
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
32
32
  end
33
33
 
34
34
  private
@@ -16,19 +16,19 @@ module RunApi
16
16
  @http = http
17
17
  end
18
18
 
19
- def run(**params)
20
- task = create(**params)
21
- poll_until_complete { get(task.id) }
19
+ def run(options: nil, **params)
20
+ task = create(options: options, **params)
21
+ poll_until_complete { get(task.id, options: options) }
22
22
  end
23
23
 
24
- def create(**params)
24
+ def create(options: nil, **params)
25
25
  params = compact_params(params)
26
26
  validate_params!(params)
27
- request(:post, ENDPOINT, body: params)
27
+ request(:post, ENDPOINT, body: params, options: options)
28
28
  end
29
29
 
30
- def get(id)
31
- request(:get, "#{ENDPOINT}/#{id}")
30
+ def get(id, options: nil)
31
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
32
32
  end
33
33
 
34
34
  private
@@ -40,8 +40,9 @@ module RunApi
40
40
  duration_seconds = param(params, :duration_seconds)
41
41
  if duration_seconds
42
42
  int = duration_seconds.to_i
43
- unless Types::DURATION_RANGE.cover?(int)
44
- raise Core::ValidationError, "duration_seconds must be an integer between 6 and 30"
43
+ range = (param(params, :model) == Types::PREVIEW_MODEL) ? Types::PREVIEW_DURATION_RANGE : Types::DURATION_RANGE
44
+ unless range.cover?(int)
45
+ raise Core::ValidationError, "duration_seconds must be an integer between #{range.min} and #{range.max}"
45
46
  end
46
47
  end
47
48
  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_params!(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
 
35
35
  private
@@ -4,6 +4,8 @@ module RunApi
4
4
  module GrokImagine
5
5
  module Types
6
6
  DURATION_RANGE = (6..30)
7
+ PREVIEW_MODEL = "grok-imagine-video-1.5-preview"
8
+ PREVIEW_DURATION_RANGE = (1..15)
7
9
  EXTENSION_DURATION_SECONDS = [6, 10].freeze
8
10
  INDEX_RANGE = (0..5)
9
11
 
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.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,18 +15,18 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.7
18
+ version: 0.2.11
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.2.11
26
26
  description: The Grok Imagine Ruby SDK is the language-specific package for Grok Imagine
27
- on RunAPI. Use this package for image generation, image editing, and creative production
28
- workflows when your application needs request bodies, task status lookup, and consistent
29
- RunAPI errors in Ruby.
27
+ on RunAPI. Use this package for image and video generation, image editing, and creative
28
+ production workflows when your application needs request bodies, task status lookup,
29
+ and consistent RunAPI errors in Ruby.
30
30
  email:
31
31
  - contact@runapi.ai
32
32
  executables: []