@ohmygame/minimax 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,147 @@
1
+ {
2
+ "$schema": "https://www.ohmygame.ai/schema/plugin-2.json",
3
+ "id": "ohmygame/minimax",
4
+ "version": "0.1.1",
5
+ "engines": {
6
+ "ohmygame-api": "^2.7.0"
7
+ },
8
+ "displayName": "%plugin.name%",
9
+ "description": "%plugin.description%",
10
+ "longDescription": "%plugin.longDescription%",
11
+ "icon": "./assets/icon.svg",
12
+ "categories": ["provider"],
13
+ "beta": true,
14
+ "capabilities": {
15
+ "network": ["api.minimax.cn", "api.minimax.io", "cdn.hailuoai.com"]
16
+ },
17
+ "configuration": {
18
+ "cnApiKey": {
19
+ "type": "secret",
20
+ "title": "%config.cn.title%",
21
+ "description": "%config.cn.description%"
22
+ },
23
+ "globalApiKey": {
24
+ "type": "secret",
25
+ "title": "%config.global.title%",
26
+ "description": "%config.global.description%"
27
+ }
28
+ },
29
+ "contributes": {
30
+ "providers": [
31
+ {
32
+ "id": "cn",
33
+ "title": "%provider.cn%",
34
+ "icon": "./assets/icon.svg",
35
+ "apiKey": "cnApiKey",
36
+ "media": {
37
+ "adapter": "./media/adapter.js",
38
+ "video": {
39
+ "models": [
40
+ {
41
+ "id": "MiniMax-H3",
42
+ "title": "MiniMax H3",
43
+ "durations": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
44
+ "resolutions": ["768p", "2K"],
45
+ "aspectRatios": ["16:9", "21:9", "4:3", "1:1", "3:4", "9:16"],
46
+ "imageAspectRatios": [
47
+ "adaptive",
48
+ "16:9",
49
+ "21:9",
50
+ "4:3",
51
+ "1:1",
52
+ "3:4",
53
+ "9:16"
54
+ ],
55
+ "frameAspectRatios": ["adaptive"],
56
+ "maxReferenceImages": 9,
57
+ "referenceModes": ["frame", "reference"],
58
+ "data": {
59
+ "region": "cn"
60
+ }
61
+ },
62
+ {
63
+ "id": "MiniMax-H3-Max",
64
+ "title": "MiniMax H3 Max",
65
+ "durations": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
66
+ "resolutions": ["480p", "768p"],
67
+ "aspectRatios": ["16:9", "21:9", "4:3", "1:1", "3:4", "9:16"],
68
+ "imageAspectRatios": [
69
+ "adaptive",
70
+ "16:9",
71
+ "21:9",
72
+ "4:3",
73
+ "1:1",
74
+ "3:4",
75
+ "9:16"
76
+ ],
77
+ "frameAspectRatios": ["adaptive"],
78
+ "maxReferenceImages": 9,
79
+ "referenceModes": ["frame", "reference"],
80
+ "data": {
81
+ "region": "cn"
82
+ }
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ },
88
+ {
89
+ "id": "global",
90
+ "title": "%provider.global%",
91
+ "icon": "./assets/icon.svg",
92
+ "apiKey": "globalApiKey",
93
+ "media": {
94
+ "adapter": "./media/adapter.js",
95
+ "video": {
96
+ "models": [
97
+ {
98
+ "id": "MiniMax-H3",
99
+ "title": "MiniMax H3",
100
+ "durations": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
101
+ "resolutions": ["768p", "2K"],
102
+ "aspectRatios": ["16:9", "21:9", "4:3", "1:1", "3:4", "9:16"],
103
+ "imageAspectRatios": [
104
+ "adaptive",
105
+ "16:9",
106
+ "21:9",
107
+ "4:3",
108
+ "1:1",
109
+ "3:4",
110
+ "9:16"
111
+ ],
112
+ "frameAspectRatios": ["adaptive"],
113
+ "maxReferenceImages": 9,
114
+ "referenceModes": ["frame", "reference"],
115
+ "data": {
116
+ "region": "global"
117
+ }
118
+ },
119
+ {
120
+ "id": "MiniMax-H3-Max",
121
+ "title": "MiniMax H3 Max",
122
+ "durations": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
123
+ "resolutions": ["480p", "768p"],
124
+ "aspectRatios": ["16:9", "21:9", "4:3", "1:1", "3:4", "9:16"],
125
+ "imageAspectRatios": [
126
+ "adaptive",
127
+ "16:9",
128
+ "21:9",
129
+ "4:3",
130
+ "1:1",
131
+ "3:4",
132
+ "9:16"
133
+ ],
134
+ "frameAspectRatios": ["adaptive"],
135
+ "maxReferenceImages": 9,
136
+ "referenceModes": ["frame", "reference"],
137
+ "data": {
138
+ "region": "global"
139
+ }
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ ]
146
+ }
147
+ }
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md CHANGED
@@ -1,3 +1,83 @@
1
- # Temporary Holding Version
1
+ # MiniMax Video
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Optional MiniMax H3 and H3 Max video provider for OhMyGame, with independent China
4
+ and Global API keys. Includes text-to-video, first/last frames and up to nine
5
+ reference images. The provider and plugin details use the MiniMax logo.
6
+
7
+ This is an optional beta plugin. It needs OhMyGame API 2.7 with
8
+ reference-dependent video aspect ratios ([app #825](https://github.com/WhiteTowerAI/ohmygame/pull/825)).
9
+ Install it from the plugin catalog in a compatible app. It is not preinstalled.
10
+ Apps with MiniMax migration support can move existing keys, switches, global and
11
+ project defaults, and saved canvas selections to this plugin. Migration requires
12
+ an enabled, authorized official npm release whose exact contents the app has
13
+ reviewed. An unpacked development folder is not a migration target. Installing or
14
+ updating the plugin alone does not activate migration; see the app's
15
+ [migration and cutover guide](https://github.com/WhiteTowerAI/ohmygame/blob/dev/docs/media-provider-plugins.md#minimax-committed-profile-cutover).
16
+
17
+ After migration commits, manage MiniMax credentials in this plugin. The app keeps
18
+ original keys and task history, hides the built-in connection, and does not
19
+ reactivate it if the plugin is disabled or removed. Old built-in jobs have no
20
+ recoverable vendor task ID: check their status in MiniMax before intentionally
21
+ starting a new generation. Plugin jobs retain the recovery behavior below.
22
+
23
+ 支持迁移的应用会在确认官方 npm 包、启用状态和授权后,迁移密钥、开关、默认模型和
24
+ 画布选择。迁移后在插件中管理密钥;停用或卸载插件不会恢复旧内置服务。原密钥及
25
+ 任务记录保留,旧内置任务无法安全恢复,请先在 MiniMax 确认任务状态再决定是否重新生成。
26
+
27
+ ## Local testing / 本地测试
28
+
29
+ 1. Use an app with OhMyGame API 2.7. In Plugins, install this `plugins/minimax`
30
+ folder, review its three network hosts, then enable it for every project.
31
+ 在配套应用分支中,打开插件页,安装本目录并启用;检查图标和中英文说明。
32
+ 2. Set either **China API key** from [platform.minimax.cn](https://platform.minimax.cn/)
33
+ or **Global API key** from [platform.minimax.io](https://platform.minimax.io/).
34
+ Only the configured region's provider should appear in the video picker.
35
+ 两区密钥独立;仅填写一区时,另一地区不应出现在可用视频模型中。
36
+ 3. Select **MiniMax China (plugin)** or **MiniMax Global (plugin)** in an asset
37
+ canvas. Check H3 (4–15 s, 768p/2K) and H3 Max (5–15 s, 480p/768p). Without
38
+ pictures choose a concrete ratio; first/last frames offer only adaptive;
39
+ reference mode offers adaptive and concrete ratios, with at most nine images.
40
+ 切换文字、首尾帧与参考图时检查画幅选项;首尾帧最多两张,参考图最多九张。
41
+ 4. With your own account, generate one short video and confirm the MP4 saves and
42
+ plays. This makes a paid vendor request. Inspect its task in the MiniMax
43
+ console. Quit while another task is pending, reopen and retry the same job:
44
+ it should query the original task, without a second creation request.
45
+ 自行测试一次真实生成与重启恢复;确认控制台没有重复付费任务。
46
+ 5. Stop a pending job. Local waiting should end promptly; inspect the original
47
+ job in MiniMax yourself. **Stop does not cancel the remote job or its charges.**
48
+ MiniMax's DELETE endpoint also deletes completed records, so this plugin does
49
+ not call it. Retry after a deliberate stop is a new generation.
50
+ 停止仅结束本地等待,远端任务可能继续并计费;停止后重试会创建新任务。
51
+ 6. For migration testing, use an isolated profile and the official npm version
52
+ reviewed by the app. Restart after enabling it for every project. Check both
53
+ regions' choices, defaults and saved boards; original keys and historical
54
+ task inputs must remain on disk. After migration, disable the plugin: its
55
+ models disappear and the old built-in provider stays retired. A profile
56
+ whose migration is deferred keeps its existing built-in connection.
57
+ 使用独立测试目录及应用已校验的官方 npm 版本验证迁移;确认密钥、开关、默认选择
58
+ 和历史任务保留。迁移后禁用插件不能回退到旧服务;尚未迁移的账户保持原行为。
59
+
60
+ Automated tests use the actual sandbox adapter, host permission/network boundary,
61
+ regional secret lookup and durable journals with mocked HTTP. They cover request
62
+ roles and ratios, restart, ambiguous submission, transient checks, rejected CDN
63
+ hosts and downloads without keys. They make no live or paid vendor requests.
64
+
65
+ ## Protocol and release notes
66
+
67
+ The sandbox cannot read keys or local files. The app adds the selected region's
68
+ Bearer key to API requests and downloads outputs without it. Allowed hosts are
69
+ `api.minimax.cn`, `api.minimax.io` and `cdn.hailuoai.com` (the official query example's
70
+ output host). A new CDN host requires review and an updated network grant; an
71
+ unexpected host fails visibly instead of broadening access.
72
+
73
+ A lost create response or server error is treated as possibly accepted; retry
74
+ cannot submit another paid job. Check the vendor console before starting a new
75
+ one. A structured 4xx rejection allows a corrected retry. Repeated polling errors
76
+ end the attempt under the host's existing retry policy; they never submit a new
77
+ task automatically. Only a normal app shutdown preserves a pending job for resume.
78
+
79
+ Sources checked 2026-11-14:
80
+ [create](https://platform.minimax.io/docs/api-reference/video-generation-v2-create),
81
+ [query](https://platform.minimax.io/docs/api-reference/video-generation-v2-query),
82
+ [cancel/delete](https://platform.minimax.io/docs/api-reference/video-generation-v2-delete),
83
+ [China endpoint](https://platform.minimax.cn/docs/api-reference/video-generation-v2-create).
@@ -0,0 +1,29 @@
1
+ # MiniMax logo
2
+
3
+ `icon.svg` is `minimax-color.svg` from `@lobehub/icons-static-svg` 1.94.0,
4
+ from [LobeHub Icons](https://github.com/lobehub/lobe-icons), distributed under MIT.
5
+ The inline root layout style was removed and dimensions set to 24 × 24 to meet
6
+ OhMyGame's static SVG contract; paths, colors and gradients are unchanged.
7
+
8
+ Copyright (c) 2023 LobeHub
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ The MiniMax name and logo belong to their respective owner; use identifies the
29
+ integrated service and does not imply endorsement.
@@ -0,0 +1 @@
1
+ <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><title>Minimax</title><defs><linearGradient id="lobe-icons-minimax-_R_0_" x1="0%" x2="100.182%" y1="50.057%" y2="50.057%"><stop offset="0%" stop-color="#E2167E"></stop><stop offset="100%" stop-color="#FE603C"></stop></linearGradient></defs><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z" fill="url(#lobe-icons-minimax-_R_0_)" fill-rule="nonzero"></path></svg>
@@ -0,0 +1,11 @@
1
+ {
2
+ "plugin.name": "MiniMax Video",
3
+ "plugin.description": "Make videos with MiniMax H3 and H3 Max using your own API key.",
4
+ "plugin.longDescription": "Adds separate China and Global video providers. Supports text, first/last frames and up to nine reference images. Stop ends local waiting; the remote task may continue and incur charges. Compatible app versions can move existing MiniMax settings into this plugin.",
5
+ "provider.cn": "MiniMax China (plugin)",
6
+ "provider.global": "MiniMax Global (plugin)",
7
+ "config.cn.title": "China API key",
8
+ "config.cn.description": "From platform.minimax.cn → API Keys. Only needed for the China provider.",
9
+ "config.global.title": "Global API key",
10
+ "config.global.description": "From platform.minimax.io → API Keys. Only needed for the Global provider."
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "plugin.name": "MiniMax 视频",
3
+ "plugin.description": "使用自己的 API 密钥,通过 MiniMax H3 和 H3 Max 生成视频。",
4
+ "plugin.longDescription": "提供独立的中国区和国际区视频服务,支持文字、首尾帧和最多九张参考图。停止只结束本地等待,远端任务可能继续运行并计费。支持迁移的应用版本可将原有 MiniMax 设置迁入本插件。",
5
+ "provider.cn": "MiniMax 中国区(插件)",
6
+ "provider.global": "MiniMax 国际区(插件)",
7
+ "config.cn.title": "中国区 API 密钥",
8
+ "config.cn.description": "从 platform.minimax.cn 的 API 密钥页面获取,仅中国区服务需要。",
9
+ "config.global.title": "国际区 API 密钥",
10
+ "config.global.description": "从 platform.minimax.io 的 API 密钥页面获取,仅国际区服务需要。"
11
+ }
@@ -0,0 +1,136 @@
1
+ // MiniMax H3 v2. The host owns credentials, downloads and the durable task journal.
2
+ const BASES = {
3
+ cn: "https://api.minimax.cn",
4
+ global: "https://api.minimax.io",
5
+ };
6
+
7
+ function base(region) {
8
+ if (region !== "cn" && region !== "global")
9
+ throw new Error("Unknown MiniMax account region");
10
+ return BASES[region];
11
+ }
12
+
13
+ async function read(response) {
14
+ const text = await response.text();
15
+ let answer;
16
+ try {
17
+ answer = JSON.parse(text);
18
+ } catch {
19
+ /* An unreadable success is not a definite rejection. */
20
+ }
21
+ const detail = answer && answer.error && answer.error.message;
22
+ return {
23
+ answer,
24
+ message:
25
+ typeof detail === "string" && detail
26
+ ? detail.slice(0, 500)
27
+ : `MiniMax answered HTTP ${response.status}`,
28
+ };
29
+ }
30
+
31
+ function validId(id) {
32
+ return typeof id === "string" && /^[A-Za-z0-9_-]{1,200}$/.test(id);
33
+ }
34
+
35
+ function retryAfter(response) {
36
+ const seconds = Number(response.headers["retry-after"]);
37
+ return Number.isFinite(seconds) && seconds > 0
38
+ ? Math.min(60, Math.max(1, seconds))
39
+ : 5;
40
+ }
41
+
42
+ export default {
43
+ video: {
44
+ async start(input, host) {
45
+ const region = input.modelData && input.modelData.region;
46
+ const url = base(region);
47
+ if (!input.prompt.trim())
48
+ return { error: "Enter a prompt for MiniMax video generation." };
49
+ const content = [{ type: "text", text: input.prompt }];
50
+ input.references.forEach((image, index) =>
51
+ content.push({
52
+ type: "image_url",
53
+ image_url: { url: `data:${image.mediaType};base64,${image.base64}` },
54
+ role:
55
+ input.referenceMode === "reference"
56
+ ? "reference_image"
57
+ : index === 0
58
+ ? "first_frame"
59
+ : "last_frame",
60
+ }),
61
+ );
62
+ const response = await host.fetch(url + "/v2/video_generation", {
63
+ method: "POST",
64
+ auth: true,
65
+ json: {
66
+ model: input.model,
67
+ content,
68
+ duration: input.duration,
69
+ resolution: input.resolution.toUpperCase(),
70
+ ratio: input.aspectRatio,
71
+ },
72
+ });
73
+ const { answer, message } = await read(response);
74
+ // Only a structured vendor rejection proves that no paid task was created.
75
+ // A transport/server error, unexpected redirect or malformed answer keeps
76
+ // the host's unconfirmed marker: retry must not submit and charge again.
77
+ if (!response.ok) {
78
+ if (
79
+ response.status >= 400 &&
80
+ response.status < 500 &&
81
+ response.status !== 408 &&
82
+ answer &&
83
+ answer.type === "error" &&
84
+ answer.error
85
+ )
86
+ return { error: message };
87
+ throw new Error(message);
88
+ }
89
+ if (!answer || !validId(answer.task_id))
90
+ throw new Error(
91
+ "MiniMax returned no task ID; check your MiniMax account before starting another video.",
92
+ );
93
+ return {
94
+ task: { id: answer.task_id, region },
95
+ retryAfter: retryAfter(response),
96
+ };
97
+ },
98
+
99
+ async check(task, host) {
100
+ if (!task || !validId(task.id))
101
+ throw new Error("Invalid MiniMax task ID");
102
+ const response = await host.fetch(
103
+ base(task.region) +
104
+ "/v2/query/video_generation/" +
105
+ encodeURIComponent(task.id),
106
+ { auth: true },
107
+ );
108
+ const { answer, message } = await read(response);
109
+ // Transient/unreadable checks never become a second start request.
110
+ if (!response.ok) throw new Error(message);
111
+ const result = answer && answer.task;
112
+ if (!result || result.id !== task.id)
113
+ throw new Error("MiniMax returned a different or missing task");
114
+ if (result.status === "queued" || result.status === "running")
115
+ return { retryAfter: retryAfter(response) };
116
+ if (["failed", "cancelled", "expired"].includes(result.status)) {
117
+ const detail = result.error && result.error.message;
118
+ return {
119
+ error:
120
+ typeof detail === "string" && detail
121
+ ? detail
122
+ : `MiniMax task ${result.status}`,
123
+ };
124
+ }
125
+ if (result.status !== "succeeded")
126
+ throw new Error("Unknown MiniMax task status");
127
+ const url = result.content && result.content.url;
128
+ if (typeof url !== "string" || !url)
129
+ throw new Error("MiniMax returned no video URL");
130
+ // The host validates the URL against the network grant and downloads without auth.
131
+ return { outputs: [{ url }] };
132
+ },
133
+ // Deliberately no cancel: DELETE also erases completed tasks, and a check
134
+ // before DELETE cannot close that race. Stop ends local polling only.
135
+ },
136
+ };
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@ohmygame/minimax",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "MiniMax H3 video models for China and Global accounts.",
5
+ "keywords": [
6
+ "ohmygame-plugin",
7
+ "model-provider",
8
+ "minimax",
9
+ "video"
10
+ ],
11
+ "license": "Apache-2.0",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/WhiteTowerAI/ohmygame-plugins.git",
15
+ "directory": "plugins/minimax"
16
+ },
17
+ "files": [
18
+ ".ohmygame-plugin",
19
+ "assets",
20
+ "locales",
21
+ "media"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }