Repository navigation
feat(tools): support MiniMax H3 text-to-image generation - #1708
octo-patch wants to merge 1 commit into
Conversation
clark-cant
left a comment
There was a problem hiding this comment.
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; noMiniMax-H3symbol exists in the tree (code search empty); the existinginternal/tools/create_image_minimax.gocoversimage-01only, 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 andResult/Usageshapes. 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 —
minimaxH3Endpointhardcodes one region rewrite (https://api.minimaxi.com/v1→https://api.minimax.cn/v1). It is unit-tested, but the rewrite is surprising (a.combase silently becomes.cn) and only matches that exact string. Consider making the regional endpoint config-driven, or documenting why the.combase must be rewritten. - Suggestion —
callMinimaxH3Imagewraps every post-submission error, including a definitive non-200 HTTP response (e.g. 429/5xx), inerrMinimaxH3Submitted, andExecuteWithChainthen 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=1are applied by mutating the loop-localentrycopy inExecuteWithChain; 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
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
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
CreateImageTool.Executewith 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.go build ./...,go build -tags sqliteonly ./...,go vet ./...andgo test -race -timeout=5m ./.... The race suite ran with isolated loopback because the browser package expects local port 9222 to be unused.go fix ./...in a separate checkout. It reports overlapping edits ininternal/skills, also reproduced on the unchanged base. It proposed no changes to this patch's files.MiniMax H3 API reference · China region reference