Skip to content

feat(minimax): add video generation actions - #225

Merged
l1shen merged 2 commits into
oomol-lab:mainfrom
octo-patch:octo/20260729-text-to-video-tool-recvqaj8HwC9Ig
Jul 30, 2026
Merged

feat(minimax): add video generation actions#225
l1shen merged 2 commits into
oomol-lab:mainfrom
octo-patch:octo/20260729-text-to-video-tool-recvqaj8HwC9Ig

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Reason: The MiniMax connector exposed only model listing, model retrieval, text Responses, and token estimation, so it could not generate video.

This extends the existing minimax provider with asynchronous video generation actions:

  • text_to_video and image_to_video create POST /v1/video_generation tasks. text_to_video requires model and prompt; image_to_video requires model and first_frame_image. Both accept the optional prompt_optimizer, fast_pretreatment, duration, resolution, and callback_url request fields.
  • query_video_generation polls task progress via GET /v1/query/video_generation and surfaces task_id, status, and file_id.
  • download_video retrieves the generated file metadata and its download URL via GET /v1/files/retrieve.
  • The model field is an enum that defaults to MiniMax-Hailuo-2.3 and covers the documented video models.
  • An optional region field selects the global (https://api.minimax.io) or China (https://api.minimaxi.com) host; the existing text actions keep using the global host. All requests continue to go through the shared SSRF-guarded fetcher.

Checks:

  • npm run fix-check (oxlint + oxfmt + src typecheck)
  • npm run generate:catalog
  • npm test (vitest, 554 tests passing)

Add text_to_video, image_to_video, query_video_generation, and
download_video actions to the MiniMax provider, covering the global and
China hosts, the documented MiniMax-Hailuo-2.3 video models, required
request fields, asynchronous task query, and generated file retrieval.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Added async MiniMax video actions: text-to-video, image-to-video, video status queries, and video downloads.
    • Introduced support for region-specific MiniMax endpoints (global vs China) for video workflows.
    • Extended MiniMax credential setup with an optional region selection for better routing.
  • Bug Fixes
    • Improved handling of MiniMax responses that include body-level error status codes, now returning proper failures.
  • Tests
    • Added coverage for video action validation, download metadata, region routing, and error mapping.

Walkthrough

MiniMax now exposes text-to-video, image-to-video, task-status query, and video-download actions with schemas for asynchronous requests and responses. Credentials support global and China regions, and request helpers route through the selected API host. Video handlers use the regional context, while response handling maps MiniMax body-level errors. Tests cover validation, output typing, error mapping, regional routing, metadata, and invalid regions.

Sequence Diagram(s)

sequenceDiagram
  participant ProviderAction
  participant minimaxActionHandlers
  participant minimaxRequestJson
  participant MiniMaxAPI
  ProviderAction->>minimaxActionHandlers: invoke video action
  minimaxActionHandlers->>minimaxRequestJson: pass normalized request
  minimaxRequestJson->>MiniMaxAPI: create task, query status, or download video
  MiniMaxAPI-->>minimaxRequestJson: return response or body-level error
  minimaxRequestJson-->>ProviderAction: return action result or mapped error
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required type(scope): subject format and accurately describes the MiniMax video generation change.
Description check ✅ Passed The description clearly matches the PR by describing the new MiniMax video generation actions, region support, and related checks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/providers/minimax/actions.ts (1)

218-279: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Shared model enum doesn't restrict text-to-video vs. image-to-video model compatibility.

videoModelSchema (built from the single videoModels list) is reused verbatim for both textToVideoInputSchema and imageToVideoInputSchema. But per MiniMax's naming/documentation, T2V-01-Director/T2V-01 are text-to-video-only and I2V-01-Director/I2V-01-live/I2V-01 are image-to-video-only, and MiniMax-Hailuo-2.3-Fast is documented as image-to-video only (not available for text-to-video). With the shared enum, a client can request text_to_video with I2V-01 or MiniMax-Hailuo-2.3-Fast, or image_to_video with T2V-01, and the invalid combination will only surface as an opaque MiniMax error after task submission instead of being caught by the schema.

Consider splitting into textToVideoModels/imageToVideoModels (or two enums) so each input schema only accepts models valid for that mode.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/minimax/actions.ts` around lines 218 - 279, Split the shared
videoModels/videoModelSchema definitions into mode-specific model lists and
schemas. Update textToVideoInputSchema to accept only text-to-video models, and
imageToVideoInputSchema to accept only image-to-video models, including
MiniMax-Hailuo-2.3-Fast only for image-to-video. Keep the existing defaults and
schema descriptions where applicable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/providers/minimax/actions.ts`:
- Around line 218-279: Split the shared videoModels/videoModelSchema definitions
into mode-specific model lists and schemas. Update textToVideoInputSchema to
accept only text-to-video models, and imageToVideoInputSchema to accept only
image-to-video models, including MiniMax-Hailuo-2.3-Fast only for
image-to-video. Keep the existing defaults and schema descriptions where
applicable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7699679e-703d-47df-b8a5-d7da37d7e782

📥 Commits

Reviewing files that changed from the base of the PR and between 14eb198 and 8422a6e.

📒 Files selected for processing (2)
  • src/providers/minimax/actions.ts
  • src/providers/minimax/executors.ts

@l1shen

l1shen commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

这次把 MiniMax 的 region 收到 API key 连接配置里,校验和后续请求会统一走对应的 global/china host。同时补了 base_resp 的错误处理,拆分了文生视频和图生视频的模型范围,并收紧了 duration、resolution 以及 file_id 的 schema。相关回归测试也补上了,fix-check 和全量测试都已通过。

@l1shen
l1shen merged commit 91c50b2 into oomol-lab:main Jul 30, 2026
2 of 3 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
src/providers/minimax/executors.ts (1)

72-95: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant region re-validation.

readMinimaxRegion(input.values.region) is called explicitly, then its result is fed into minimaxBaseUrlForRegion, which calls readMinimaxRegion again internally on the already-normalized value. createContext (Line 65) shows the simpler pattern of passing the raw value straight to minimaxBaseUrlForRegion.

♻️ Proposed simplification
   async apiKey(input, { fetcher, signal }) {
-    const region = readMinimaxRegion(input.values.region);
-    const apiBaseUrl = minimaxBaseUrlForRegion(region);
+    const apiBaseUrl = minimaxBaseUrlForRegion(input.values.region);
     const payload = await minimaxGetJson("/v1/models", {

Also applies to: 173-186

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/minimax/executors.ts` around lines 72 - 95, Remove the explicit
readMinimaxRegion call in credentialValidators.apiKey and pass
input.values.region directly to minimaxBaseUrlForRegion, matching the pattern
used by createContext. Apply the same simplification to the other affected
region-handling block around the alternate referenced section.
src/providers/minimax/actions.ts (1)

229-250: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Align stringEnum call shapes consistently

stringEnum intentionally supports both (values, options?) and (description, values) forms, so these resolution schemas are not malformed. Pick one call shape for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/minimax/actions.ts` around lines 229 - 250, Align the call
shape of textToVideoResolutionSchema and imageToVideoResolutionSchema with the
surrounding stringEnum schemas, using one consistent supported signature for
both resolution definitions. Preserve their existing descriptions and allowed
resolution values.
src/providers/minimax/definition.ts (1)

18-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a schema-level constraint for the MiniMax region value.

region is accepted as text in the definition, while readMinimaxRegion() only allows global or china and throws a 400 otherwise. Add an enum/validation constraint in the metadata/schema or normalize the value before constructing the API base URL so invalid regions fail during validation rather than at connect time.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/minimax/definition.ts` around lines 18 - 30, Add schema-level
validation to the MiniMax extraFields region definition so only “global” and
“china” are accepted, matching readMinimaxRegion(). Ensure invalid values are
rejected during configuration validation before the API base URL is constructed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/providers/minimax/actions.ts`:
- Around line 229-250: Align the call shape of textToVideoResolutionSchema and
imageToVideoResolutionSchema with the surrounding stringEnum schemas, using one
consistent supported signature for both resolution definitions. Preserve their
existing descriptions and allowed resolution values.

In `@src/providers/minimax/definition.ts`:
- Around line 18-30: Add schema-level validation to the MiniMax extraFields
region definition so only “global” and “china” are accepted, matching
readMinimaxRegion(). Ensure invalid values are rejected during configuration
validation before the API base URL is constructed.

In `@src/providers/minimax/executors.ts`:
- Around line 72-95: Remove the explicit readMinimaxRegion call in
credentialValidators.apiKey and pass input.values.region directly to
minimaxBaseUrlForRegion, matching the pattern used by createContext. Apply the
same simplification to the other affected region-handling block around the
alternate referenced section.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4fb12ea-a014-4bf4-85e1-1f6e80225f42

📥 Commits

Reviewing files that changed from the base of the PR and between 8422a6e and d64fee8.

📒 Files selected for processing (4)
  • src/providers/minimax/actions.ts
  • src/providers/minimax/definition.ts
  • src/providers/minimax/executors.test.ts
  • src/providers/minimax/executors.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants