Skip to content

feat: support MiniMax-H3-Image generation and editing - #306

Merged
SaladDay merged 2 commits into
MiniMax-AI:mainfrom
jellyjelly814:feat/h3-image
Nov 10, 2026
Merged

SaladDay merged 2 commits into
MiniMax-AI:mainfrom
jellyjelly814:feat/h3-image

Conversation

@jellyjelly814

@jellyjelly814 jellyjelly814 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds MiniMax-H3-Image to the CLI and SDK: text-to-image (POST /v1/images/generations) and image editing (POST /v1/images/edits). The default model stays image-01; H3 is opt-in with --model MiniMax-H3-Image.

# text-to-image
mmx image "An orange cat on a windowsill" --model MiniMax-H3-Image --aspect-ratio 16:9 --area 2K --n 2
mmx image "Poster" --model MiniMax-H3-Image --size 2720x1536 --output-format png --no-prompt-enhance

# image editing: --image switches to /v1/images/edits (1-16 images; local file, URL, data URI or mm_file://)
mmx image generate --model MiniMax-H3-Image --prompt "Replace the cat in Picture 1 with the dog in Picture 2" --image cat.jpg --image https://example.com/dog.png
await sdk.image.generate({ model: 'MiniMax-H3-Image', prompt: 'cat', aspect_ratio: '16:9', area: '2K' });
await sdk.image.generate({ model: 'MiniMax-H3-Image', prompt: 'swap', images: [{ image_url: 'https://...' }] });

Design notes

  • Editing is image generate --image rather than a new image edit subcommand, so the mmx image "<prompt>" shortcut (single-subcommand forwarding) keeps working. This mirrors --image on H3 video.
  • Validation and request building live in src/image/h3.ts (pure functions shared by CLI and SDK, same pattern as src/video/v2.ts).
  • Requests are checked locally against the documented limits: size WxH area 655,360–20,000,000 px and ratio 1:3–3:1; size WxH cannot be combined with aspect_ratio/area; aspect_ratio X:Y with integers 1–300; n 1–10; 1–16 reference images; 64 MiB file/body; b64_json total area (20 MP png / 80 MP jpeg·webp, size auto counted by area); --no-prompt-enhance is text-to-image only and needs a concrete size or ratio.
  • The endpoints are synchronous (server waits up to 600 s) and not idempotent, so the request timeout is at least 600 s and nothing is retried.
  • Partial success (HTTP 200 with some data[].error): successful images are saved, files keep their original index (image_001, image_003, ...), failures go to stderr (also with --quiet) and to failures / failed_count in JSON output.
  • All-failed responses (422/402/500): the trailing (NNNN) code in error.message is parsed for /v1/images/* only (1026/1027 → content filter, 2068 → plan message), and per-image reasons from data[] are added to the hint.
  • H3-only flags with image-01, and --seed / --prompt-optimizer / --subject-ref with H3, fail with a usage error. --width/--height are shorthand for --size on H3. --response-format base64 is accepted as an alias of b64_json.
  • Out of scope: streaming output.

API docs: CN, Global

Docs

README.md, README_CN.md, SDK.md, skill/SKILL.md.

Tests

  • bun run typecheck, bun run lint (0 errors; existing warning in test/sdk/speech.test.ts), bun run build.
  • bun test: 674 pass, 1 fail. The failure (Zed configuration > ... XDG_CONFIG_HOME) also fails on main locally and is unrelated.
  • New: test/image/h3.test.ts, test/errors/api-images.test.ts; extended test/commands/image/generate.test.ts (mock server: partial failure, edits routing) and test/sdk/image.test.ts.
  • --dry-run checked for text-to-image, editing, --no-prompt-enhance, b64_json limits and the legacy image-01 path.
  • Not yet run against the live API.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jellyjelly814 and others added 2 commits November 10, 2026 15:14
…limit

mmx image generate help now points at /docs/guides/image-generation.
On /v1/images/*, error 1002 (IPM) uses the existing rate-limit path;
1026 and 1027 remain content-safety mappings.
@SaladDay

Copy link
Copy Markdown
Collaborator

LGTM, THANKS!!

@SaladDay
SaladDay merged commit ae29aae into MiniMax-AI:main Nov 10, 2026
3 checks passed
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