Skip to content

feat(tools): support MiniMax H3 text-to-image generation - #1708

Open
octo-patch wants to merge 1 commit into
nextlevelbuilder:devfrom
octo-patch:feat/minimax-h3-image-reczz28g2i7kRpaG
Open

octo-patch wants to merge 1 commit into
nextlevelbuilder:devfrom
octo-patch:feat/minimax-h3-image-reczz28g2i7kRpaG

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Reason: Choosing a MiniMax H3 model in the image provider chain sends the prompt to the legacy image endpoint, which uses a different response format.

Summary

  • List both H3 image models in the provider catalog so operators can select them in the existing media-chain editor. Existing configurations keep their current default.
  • Send a single text-to-image request to the configured regional endpoint and request a base64 PNG. The tool writes the image to the workspace and reports token and image usage. Reference-image input is rejected before submission.
  • Allow at least ten minutes for generation. After submission, an error stops both retries and provider fallback because a disconnected request can still complete and incur a charge.

The web and desktop media-chain editors use the existing provider and model settings. The change uses the existing tool arguments and output format.

Test plan

  • Exercised CreateImageTool.Execute with mocked HTTP for both H3 models. Verified PNG output, error responses, usage, redirects, retry and fallback suppression, and legacy image handling. Tested the regional URLs and the minimum chain deadline.
  • Passed go build ./..., go build -tags sqliteonly ./..., go vet ./... and go test -race -timeout=5m ./.... The race suite ran with isolated loopback because the browser package expects local port 9222 to be unused.
  • Ran the tagged integration suite with the race detector. Service-dependent cases were skipped locally, including cases that require PostgreSQL with pgvector.
  • Ran go fix ./... in a separate checkout. It reports overlapping edits in internal/skills, also reproduced on the unchanged base. It proposed no changes to this patch's files.

MiniMax H3 API reference · China region reference

@clark-cant clark-cant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary: Adds MiniMax H3 text-to-image support to create_image. Two H3 models are listed in the provider catalog; callProvider routes them to a new callMinimaxH3Image that POSTs a single text-to-image request to /images/generations (b64 PNG), rejects reference-image input up front, and reports token/image usage. The chain extends the deadline to ≥600s and suppresses retry + provider fallback once a request is submitted (billable, non-idempotent). 6 files, +271/−1.

Risk level: Low.

Mandatory gates:

  • Duplicate / prior implementation: clear. gh pr list --state all --search "MiniMax H3 image" returns only this PR; no MiniMax-H3 symbol exists in the tree (code search empty); the existing internal/tools/create_image_minimax.go covers image-01 only, so this extends the provider rather than duplicating it.
  • Project standards: docs found (CLAUDE.md). New file is domain-anchored (create_image_minimax_h3.go), under the 200-line limit, and reuses the existing chain/credential plumbing and Result/Usage shapes. No i18n/migration/SQL surface touched.
  • Strategic necessity: clear value. Adds operator-selectable H3 image models through the existing media-chain editor; small, well-scoped, and tested.

Findings:

  • Suggestion — minimaxH3Endpoint hardcodes one region rewrite (https://api.minimaxi.com/v1 → https://api.minimax.cn/v1). It is unit-tested, but the rewrite is surprising (a .com base silently becomes .cn) and only matches that exact string. Consider making the regional endpoint config-driven, or documenting why the .com base must be rewritten.
  • Suggestion — callMinimaxH3Image wraps every post-submission error, including a definitive non-200 HTTP response (e.g. 429/5xx), in errMinimaxH3Submitted, and ExecuteWithChain then aborts retries and fallback. A clean HTTP error response means the upstream did not bill, so suppressing retry/fallback there is stricter than the stated "a disconnected request can still complete and incur a charge" rationale. Consider suppressing only transport/decode failures and allowing retry on definitive HTTP error responses.
  • Note — the ≥600s deadline and MaxRetries=1 are applied by mutating the loop-local entry copy in ExecuteWithChain; correct today (range copy) but a small helper would make the intent clearer.

Verdict: Approve — no critical or important issues. mergeable=MERGEABLE, mergeStateStatus=CLEAN; all three CI checks green (run 46522040750: release-versioning, go, web). Tests are genuine: mocked HTTP with request-body assertions, a single-POST check (redirect not followed), item/service/malformed error cases, chain-deadline assertion, and endpoint mapping.

Posted by /ck:review-pr at 2026-11-30T22:15:00Z

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