runapi-grok-imagine 0.2.17 → 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 +4 -4
- data/lib/runapi/grok_imagine/resources/edit_image.rb +0 -7
- data/lib/runapi/grok_imagine/resources/extensions.rb +0 -15
- data/lib/runapi/grok_imagine/resources/image_to_video.rb +0 -28
- data/lib/runapi/grok_imagine/resources/segment_map.rb +0 -7
- data/lib/runapi/grok_imagine/resources/text_to_image.rb +0 -8
- data/lib/runapi/grok_imagine/resources/text_to_video.rb +0 -24
- data/lib/runapi/grok_imagine/resources/upscales.rb +0 -7
- data/lib/runapi/grok_imagine/types.rb +0 -5
- data/lib/runapi/grok_imagine.rb +0 -1
- metadata +4 -5
- data/lib/runapi/grok_imagine/contract_gen.rb +0 -344
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ded1f17ee27ea49f6a4c4c5475d70cdaf2e9f39dad72c30f04d0f00bc86d5c9c
|
|
4
|
+
data.tar.gz: 1ca7cc78036d91593e186927ed3b3f0f05f28bb52dd8fe4a07c8ea7d95c0733d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e6896bc99b0f1dd270f39b382d7d4eec71def5077b95fbc00f05dcd4dc574270c99f0b13586b78ab8c45e8285789aff7fc4edd2c335553b3b4b594c7985b95d
|
|
7
|
+
data.tar.gz: 8a50ad69c43af25a96a26281befba05ad05db9c883c579dd5e91b8a48bf9a822866e28a052ab29bd8129325a34e587f4a91920172ea91f06481423c334b16056
|
|
@@ -27,19 +27,12 @@ module RunApi
|
|
|
27
27
|
|
|
28
28
|
def create(options: nil, **params)
|
|
29
29
|
params = compact_params(params)
|
|
30
|
-
validate_params!(params)
|
|
31
30
|
request(:post, ENDPOINT, body: params, options: options)
|
|
32
31
|
end
|
|
33
32
|
|
|
34
33
|
def get(id, options: nil)
|
|
35
34
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
36
35
|
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def validate_params!(params)
|
|
41
|
-
validate_contract!(CONTRACT["edit-image"], params)
|
|
42
|
-
end
|
|
43
36
|
end
|
|
44
37
|
end
|
|
45
38
|
end
|
|
@@ -24,27 +24,12 @@ module RunApi
|
|
|
24
24
|
|
|
25
25
|
def create(options: nil, **params)
|
|
26
26
|
params = compact_params(params)
|
|
27
|
-
validate_params!(params)
|
|
28
27
|
request(:post, ENDPOINT, body: params, options: options)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def get(id, options: nil)
|
|
32
31
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def validate_params!(params)
|
|
38
|
-
raise Core::ValidationError, "source_task_id is required" unless param(params, :source_task_id)
|
|
39
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
40
|
-
raise Core::ValidationError, "start_seconds is required" unless param(params, :start_seconds)
|
|
41
|
-
|
|
42
|
-
extension_duration_seconds = param(params, :extension_duration_seconds)
|
|
43
|
-
raise Core::ValidationError, "extension_duration_seconds is required" unless extension_duration_seconds
|
|
44
|
-
unless Types::EXTENSION_DURATION_SECONDS.include?(extension_duration_seconds)
|
|
45
|
-
raise Core::ValidationError, "extension_duration_seconds must be one of: #{Types::EXTENSION_DURATION_SECONDS.join(", ")}"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
33
|
end
|
|
49
34
|
end
|
|
50
35
|
end
|
|
@@ -24,40 +24,12 @@ module RunApi
|
|
|
24
24
|
|
|
25
25
|
def create(options: nil, **params)
|
|
26
26
|
params = compact_params(params)
|
|
27
|
-
validate_params!(params)
|
|
28
27
|
request(:post, ENDPOINT, body: params, options: options)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def get(id, options: nil)
|
|
32
31
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def validate_params!(params)
|
|
38
|
-
validate_contract!(CONTRACT["image-to-video"], params)
|
|
39
|
-
|
|
40
|
-
source_image_url = param(params, :source_image_url)
|
|
41
|
-
source_task_id = param(params, :source_task_id)
|
|
42
|
-
|
|
43
|
-
if source_image_url && source_task_id
|
|
44
|
-
raise Core::ValidationError, "Provide either source_image_url or source_task_id, not both"
|
|
45
|
-
end
|
|
46
|
-
unless source_image_url || source_task_id
|
|
47
|
-
raise Core::ValidationError, "One of source_image_url or source_task_id is required"
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if source_task_id && (index = param(params, :index))
|
|
51
|
-
int = index.to_i
|
|
52
|
-
unless Types::INDEX_RANGE.cover?(int)
|
|
53
|
-
raise Core::ValidationError, "index must be an integer between 0 and 5"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
if param(params, :motion_style).to_s == "spicy" && source_image_url
|
|
58
|
-
raise Core::ValidationError, "spicy motion_style requires a source_task_id source image."
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
33
|
end
|
|
62
34
|
end
|
|
63
35
|
end
|
|
@@ -24,19 +24,12 @@ module RunApi
|
|
|
24
24
|
|
|
25
25
|
def create(options: nil, **params)
|
|
26
26
|
params = compact_params(params)
|
|
27
|
-
validate_params!(params)
|
|
28
27
|
request(:post, ENDPOINT, body: params, options: options)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def get(id, options: nil)
|
|
32
31
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def validate_params!(params)
|
|
38
|
-
validate_contract!(CONTRACT["segment-map"], params)
|
|
39
|
-
end
|
|
40
33
|
end
|
|
41
34
|
end
|
|
42
35
|
end
|
|
@@ -23,20 +23,12 @@ module RunApi
|
|
|
23
23
|
|
|
24
24
|
def create(options: nil, **params)
|
|
25
25
|
params = compact_params(params)
|
|
26
|
-
validate_params!(params)
|
|
27
26
|
request(:post, ENDPOINT, body: params, options: options)
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def get(id, options: nil)
|
|
31
30
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
32
31
|
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def validate_params!(params)
|
|
37
|
-
validate_contract!(CONTRACT["text-to-image"], params)
|
|
38
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
|
-
end
|
|
40
32
|
end
|
|
41
33
|
end
|
|
42
34
|
end
|
|
@@ -23,36 +23,12 @@ module RunApi
|
|
|
23
23
|
|
|
24
24
|
def create(options: nil, **params)
|
|
25
25
|
params = compact_params(params)
|
|
26
|
-
validate_params!(params)
|
|
27
26
|
request(:post, ENDPOINT, body: params, options: options)
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def get(id, options: nil)
|
|
31
30
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
32
31
|
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def validate_params!(params)
|
|
37
|
-
validate_contract!(CONTRACT["text-to-video"], params)
|
|
38
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
|
-
|
|
40
|
-
duration_seconds = param(params, :duration_seconds)
|
|
41
|
-
if duration_seconds
|
|
42
|
-
int = duration_seconds.to_i
|
|
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
|
|
51
|
-
unless range.cover?(int)
|
|
52
|
-
raise Core::ValidationError, "duration_seconds must be an integer between #{range.min} and #{range.max}"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
32
|
end
|
|
57
33
|
end
|
|
58
34
|
end
|
|
@@ -24,19 +24,12 @@ module RunApi
|
|
|
24
24
|
|
|
25
25
|
def create(options: nil, **params)
|
|
26
26
|
params = compact_params(params)
|
|
27
|
-
validate_params!(params)
|
|
28
27
|
request(:post, ENDPOINT, body: params, options: options)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def get(id, options: nil)
|
|
32
31
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
33
32
|
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def validate_params!(params)
|
|
38
|
-
raise Core::ValidationError, "source_task_id is required" unless param(params, :source_task_id)
|
|
39
|
-
end
|
|
40
33
|
end
|
|
41
34
|
end
|
|
42
35
|
end
|
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module GrokImagine
|
|
5
5
|
module Types
|
|
6
|
-
DURATION_RANGE = (6..30)
|
|
7
6
|
FAST_MODEL = "grok-imagine-video-1.5-fast"
|
|
8
|
-
FAST_DURATION_RANGE = (1..30)
|
|
9
7
|
PREVIEW_MODEL = "grok-imagine-video-1.5-preview"
|
|
10
|
-
PREVIEW_DURATION_RANGE = (1..15)
|
|
11
|
-
EXTENSION_DURATION_SECONDS = [6, 10].freeze
|
|
12
|
-
INDEX_RANGE = (0..5)
|
|
13
8
|
|
|
14
9
|
class MediaUrl < RunApi::Core::BaseModel
|
|
15
10
|
optional :url, String
|
data/lib/runapi/grok_imagine.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "runapi/core"
|
|
4
4
|
require_relative "grok_imagine/types"
|
|
5
|
-
require_relative "grok_imagine/contract_gen"
|
|
6
5
|
require_relative "grok_imagine/resources/text_to_video"
|
|
7
6
|
require_relative "grok_imagine/resources/image_to_video"
|
|
8
7
|
require_relative "grok_imagine/resources/text_to_image"
|
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.
|
|
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.
|
|
18
|
+
version: 0.6.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.
|
|
25
|
+
version: 0.6.0
|
|
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,
|
|
@@ -39,7 +39,6 @@ files:
|
|
|
39
39
|
- lib/runapi-grok_imagine.rb
|
|
40
40
|
- lib/runapi/grok_imagine.rb
|
|
41
41
|
- lib/runapi/grok_imagine/client.rb
|
|
42
|
-
- lib/runapi/grok_imagine/contract_gen.rb
|
|
43
42
|
- lib/runapi/grok_imagine/resources/edit_image.rb
|
|
44
43
|
- lib/runapi/grok_imagine/resources/extensions.rb
|
|
45
44
|
- lib/runapi/grok_imagine/resources/image_to_video.rb
|
|
@@ -72,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
71
|
- !ruby/object:Gem::Version
|
|
73
72
|
version: '0'
|
|
74
73
|
requirements: []
|
|
75
|
-
rubygems_version: 4.0.
|
|
74
|
+
rubygems_version: 4.0.10
|
|
76
75
|
specification_version: 4
|
|
77
76
|
summary: Grok Imagine Ruby SDK for RunAPI
|
|
78
77
|
test_files: []
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RunApi
|
|
4
|
-
module GrokImagine
|
|
5
|
-
CONTRACT = {
|
|
6
|
-
"edit-image" => {
|
|
7
|
-
"models" => ["grok-imagine-edit-image", "grok-imagine-image-2-0"],
|
|
8
|
-
"fields_by_model" => {
|
|
9
|
-
"grok-imagine-edit-image" => {
|
|
10
|
-
"model" => {
|
|
11
|
-
"required" => true
|
|
12
|
-
},
|
|
13
|
-
"source_image_url" => {
|
|
14
|
-
"required" => true
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"grok-imagine-image-2-0" => {
|
|
18
|
-
"aspect_ratio" => {
|
|
19
|
-
"enum" => ["1:1", "2:3", "3:2", "16:9", "9:16", "auto"],
|
|
20
|
-
"required" => true
|
|
21
|
-
},
|
|
22
|
-
"model" => {
|
|
23
|
-
"required" => true
|
|
24
|
-
},
|
|
25
|
-
"prompt" => {
|
|
26
|
-
"max" => 390000,
|
|
27
|
-
"length" => true
|
|
28
|
-
},
|
|
29
|
-
"source_image_urls" => {
|
|
30
|
-
"required" => true,
|
|
31
|
-
"min_items" => 1,
|
|
32
|
-
"max_items" => 5
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"rules" => [{
|
|
37
|
-
"when" => {
|
|
38
|
-
"model" => "grok-imagine-edit-image"
|
|
39
|
-
},
|
|
40
|
-
"forbidden" => ["source_task_id", "mask_indices", "source_image_urls", "aspect_ratio"]
|
|
41
|
-
}, {
|
|
42
|
-
"when" => {
|
|
43
|
-
"model" => "grok-imagine-image-2-0"
|
|
44
|
-
},
|
|
45
|
-
"forbidden" => ["source_image_url", "source_task_id", "mask_indices", "enable_safety_checker"]
|
|
46
|
-
}]
|
|
47
|
-
},
|
|
48
|
-
"extend" => {
|
|
49
|
-
"models" => [],
|
|
50
|
-
"fields_by_model" => {
|
|
51
|
-
"_" => {
|
|
52
|
-
"extension_duration_seconds" => {
|
|
53
|
-
"enum" => [6, 10],
|
|
54
|
-
"required" => true,
|
|
55
|
-
"type" => "integer"
|
|
56
|
-
},
|
|
57
|
-
"prompt" => {
|
|
58
|
-
"required" => true,
|
|
59
|
-
"max" => 5000,
|
|
60
|
-
"length" => true
|
|
61
|
-
},
|
|
62
|
-
"source_task_id" => {
|
|
63
|
-
"required" => true
|
|
64
|
-
},
|
|
65
|
-
"start_seconds" => {
|
|
66
|
-
"required" => true,
|
|
67
|
-
"min" => 0,
|
|
68
|
-
"type" => "integer"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"image-to-video" => {
|
|
74
|
-
"models" => ["grok-imagine-image-to-video", "grok-imagine-video-1.5-fast", "grok-imagine-video-1.5-preview"],
|
|
75
|
-
"fields_by_model" => {
|
|
76
|
-
"grok-imagine-image-to-video" => {
|
|
77
|
-
"aspect_ratio" => {
|
|
78
|
-
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
79
|
-
},
|
|
80
|
-
"duration_seconds" => {
|
|
81
|
-
"min" => 6,
|
|
82
|
-
"max" => 30,
|
|
83
|
-
"type" => "integer"
|
|
84
|
-
},
|
|
85
|
-
"index" => {
|
|
86
|
-
"min" => 0,
|
|
87
|
-
"max" => 5,
|
|
88
|
-
"type" => "integer"
|
|
89
|
-
},
|
|
90
|
-
"model" => {
|
|
91
|
-
"required" => true
|
|
92
|
-
},
|
|
93
|
-
"motion_style" => {
|
|
94
|
-
"enum" => ["fun", "normal", "spicy"]
|
|
95
|
-
},
|
|
96
|
-
"output_resolution" => {
|
|
97
|
-
"enum" => ["480p", "720p"]
|
|
98
|
-
},
|
|
99
|
-
"prompt" => {
|
|
100
|
-
"max" => 5000,
|
|
101
|
-
"length" => true
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"grok-imagine-video-1.5-fast" => {
|
|
105
|
-
"aspect_ratio" => {
|
|
106
|
-
"enum" => ["1:1", "16:9", "9:16", "3:2", "2:3"]
|
|
107
|
-
},
|
|
108
|
-
"duration_seconds" => {
|
|
109
|
-
"min" => 1,
|
|
110
|
-
"max" => 30,
|
|
111
|
-
"type" => "integer"
|
|
112
|
-
},
|
|
113
|
-
"index" => {
|
|
114
|
-
"type" => "integer"
|
|
115
|
-
},
|
|
116
|
-
"model" => {
|
|
117
|
-
"required" => true
|
|
118
|
-
},
|
|
119
|
-
"output_resolution" => {
|
|
120
|
-
"enum" => ["480p", "720p"]
|
|
121
|
-
},
|
|
122
|
-
"prompt" => {
|
|
123
|
-
"max" => 5000,
|
|
124
|
-
"length" => true
|
|
125
|
-
},
|
|
126
|
-
"source_image_url" => {
|
|
127
|
-
"required" => true
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"grok-imagine-video-1.5-preview" => {
|
|
131
|
-
"aspect_ratio" => {
|
|
132
|
-
"enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
|
|
133
|
-
},
|
|
134
|
-
"duration_seconds" => {
|
|
135
|
-
"min" => 1,
|
|
136
|
-
"max" => 15,
|
|
137
|
-
"type" => "integer"
|
|
138
|
-
},
|
|
139
|
-
"index" => {
|
|
140
|
-
"type" => "integer"
|
|
141
|
-
},
|
|
142
|
-
"model" => {
|
|
143
|
-
"required" => true
|
|
144
|
-
},
|
|
145
|
-
"output_resolution" => {
|
|
146
|
-
"enum" => ["480p", "720p", "1080p"]
|
|
147
|
-
},
|
|
148
|
-
"prompt" => {
|
|
149
|
-
"min" => 1,
|
|
150
|
-
"max" => 4096,
|
|
151
|
-
"length" => true
|
|
152
|
-
},
|
|
153
|
-
"reference_image_urls" => {
|
|
154
|
-
"max_items" => 6
|
|
155
|
-
},
|
|
156
|
-
"source_image_url" => {
|
|
157
|
-
"required" => true
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
"rules" => [{
|
|
162
|
-
"when" => {
|
|
163
|
-
"model" => "grok-imagine-image-to-video"
|
|
164
|
-
},
|
|
165
|
-
"forbidden" => ["reference_image_urls"]
|
|
166
|
-
}, {
|
|
167
|
-
"when" => {
|
|
168
|
-
"model" => "grok-imagine-video-1.5-fast"
|
|
169
|
-
},
|
|
170
|
-
"forbidden" => ["source_task_id", "index", "motion_style", "enable_safety_checker"]
|
|
171
|
-
}, {
|
|
172
|
-
"when" => {
|
|
173
|
-
"model" => "grok-imagine-video-1.5-preview"
|
|
174
|
-
},
|
|
175
|
-
"forbidden" => ["source_task_id", "index", "motion_style", "enable_safety_checker"]
|
|
176
|
-
}]
|
|
177
|
-
},
|
|
178
|
-
"segment-map" => {
|
|
179
|
-
"models" => ["grok-imagine-image-2-0"],
|
|
180
|
-
"fields_by_model" => {
|
|
181
|
-
"grok-imagine-image-2-0" => {
|
|
182
|
-
"model" => {
|
|
183
|
-
"required" => true
|
|
184
|
-
}
|
|
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
|
-
}]
|
|
204
|
-
},
|
|
205
|
-
"text-to-image" => {
|
|
206
|
-
"models" => ["grok-imagine-image-2-0", "grok-imagine-text-to-image"],
|
|
207
|
-
"fields_by_model" => {
|
|
208
|
-
"grok-imagine-image-2-0" => {
|
|
209
|
-
"aspect_ratio" => {
|
|
210
|
-
"enum" => ["1:1", "2:3", "3:2", "16:9", "9:16"],
|
|
211
|
-
"required" => true
|
|
212
|
-
},
|
|
213
|
-
"model" => {
|
|
214
|
-
"required" => true
|
|
215
|
-
},
|
|
216
|
-
"prompt" => {
|
|
217
|
-
"required" => true
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
"grok-imagine-text-to-image" => {
|
|
221
|
-
"aspect_ratio" => {
|
|
222
|
-
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
223
|
-
},
|
|
224
|
-
"model" => {
|
|
225
|
-
"required" => true
|
|
226
|
-
},
|
|
227
|
-
"prompt" => {
|
|
228
|
-
"required" => true,
|
|
229
|
-
"max" => 5000,
|
|
230
|
-
"length" => true
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
"rules" => [{
|
|
235
|
-
"when" => {
|
|
236
|
-
"model" => "grok-imagine-image-2-0"
|
|
237
|
-
},
|
|
238
|
-
"forbidden" => ["enable_safety_checker", "enable_pro"]
|
|
239
|
-
}]
|
|
240
|
-
},
|
|
241
|
-
"text-to-video" => {
|
|
242
|
-
"models" => ["grok-imagine-text-to-video", "grok-imagine-video-1.5-fast", "grok-imagine-video-1.5-preview"],
|
|
243
|
-
"fields_by_model" => {
|
|
244
|
-
"grok-imagine-text-to-video" => {
|
|
245
|
-
"aspect_ratio" => {
|
|
246
|
-
"enum" => ["2:3", "3:2", "1:1", "16:9", "9:16"]
|
|
247
|
-
},
|
|
248
|
-
"duration_seconds" => {
|
|
249
|
-
"min" => 6,
|
|
250
|
-
"max" => 30,
|
|
251
|
-
"type" => "integer"
|
|
252
|
-
},
|
|
253
|
-
"model" => {
|
|
254
|
-
"required" => true
|
|
255
|
-
},
|
|
256
|
-
"motion_style" => {
|
|
257
|
-
"enum" => ["fun", "normal", "spicy"]
|
|
258
|
-
},
|
|
259
|
-
"output_resolution" => {
|
|
260
|
-
"enum" => ["480p", "720p"]
|
|
261
|
-
},
|
|
262
|
-
"prompt" => {
|
|
263
|
-
"required" => true,
|
|
264
|
-
"max" => 5000,
|
|
265
|
-
"length" => true
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
"grok-imagine-video-1.5-fast" => {
|
|
269
|
-
"aspect_ratio" => {
|
|
270
|
-
"enum" => ["1:1", "16:9", "9:16", "3:2", "2:3"]
|
|
271
|
-
},
|
|
272
|
-
"duration_seconds" => {
|
|
273
|
-
"min" => 1,
|
|
274
|
-
"max" => 30,
|
|
275
|
-
"type" => "integer"
|
|
276
|
-
},
|
|
277
|
-
"model" => {
|
|
278
|
-
"required" => true
|
|
279
|
-
},
|
|
280
|
-
"output_resolution" => {
|
|
281
|
-
"enum" => ["480p", "720p"]
|
|
282
|
-
},
|
|
283
|
-
"prompt" => {
|
|
284
|
-
"required" => true,
|
|
285
|
-
"max" => 5000,
|
|
286
|
-
"length" => true
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
"grok-imagine-video-1.5-preview" => {
|
|
290
|
-
"aspect_ratio" => {
|
|
291
|
-
"enum" => ["1:1", "16:9", "9:16", "3:2", "2:3", "auto"]
|
|
292
|
-
},
|
|
293
|
-
"duration_seconds" => {
|
|
294
|
-
"min" => 1,
|
|
295
|
-
"max" => 15,
|
|
296
|
-
"type" => "integer"
|
|
297
|
-
},
|
|
298
|
-
"model" => {
|
|
299
|
-
"required" => true
|
|
300
|
-
},
|
|
301
|
-
"output_resolution" => {
|
|
302
|
-
"enum" => ["480p", "720p", "1080p"]
|
|
303
|
-
},
|
|
304
|
-
"prompt" => {
|
|
305
|
-
"required" => true,
|
|
306
|
-
"min" => 1,
|
|
307
|
-
"max" => 4096,
|
|
308
|
-
"length" => true
|
|
309
|
-
},
|
|
310
|
-
"reference_image_urls" => {
|
|
311
|
-
"max_items" => 7
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
"rules" => [{
|
|
316
|
-
"when" => {
|
|
317
|
-
"model" => "grok-imagine-text-to-video"
|
|
318
|
-
},
|
|
319
|
-
"forbidden" => ["reference_image_urls"]
|
|
320
|
-
}, {
|
|
321
|
-
"when" => {
|
|
322
|
-
"model" => "grok-imagine-video-1.5-fast"
|
|
323
|
-
},
|
|
324
|
-
"forbidden" => ["motion_style", "enable_safety_checker"]
|
|
325
|
-
}, {
|
|
326
|
-
"when" => {
|
|
327
|
-
"model" => "grok-imagine-video-1.5-preview"
|
|
328
|
-
},
|
|
329
|
-
"forbidden" => ["motion_style", "enable_safety_checker"]
|
|
330
|
-
}]
|
|
331
|
-
},
|
|
332
|
-
"upscale-image" => {
|
|
333
|
-
"models" => [],
|
|
334
|
-
"fields_by_model" => {
|
|
335
|
-
"_" => {
|
|
336
|
-
"source_task_id" => {
|
|
337
|
-
"required" => true
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}.freeze
|
|
343
|
-
end
|
|
344
|
-
end
|