Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ cat messages.json | mmx text chat --messages-file - --output json
mmx image "A cat in a spacesuit"
mmx image generate --prompt "A cat" --n 3 --aspect-ratio 16:9
mmx image generate --prompt "Logo" --out-dir ./out/

# MiniMax-H3-Image text-to-image
mmx image generate --model MiniMax-H3-Image --prompt "An orange cat basking on a windowsill, warm afternoon light, film look" --aspect-ratio 16:9 --area 2K
mmx image generate --model MiniMax-H3-Image --prompt "Minimal poster" --size 2720x1536 --output-format png --n 2

# MiniMax-H3-Image image editing (1-16 reference images, numbered Picture 1, 2, ... in order)
mmx image generate --model MiniMax-H3-Image --prompt "Replace the cat in Picture 1 with the Shiba Inu in Picture 2, keep the background" --image cat.jpg --image https://example.com/dog.png
```

Without `--image`, MiniMax-H3-Image calls `/v1/images/generations` (text-to-image); with `--image` it calls `/v1/images/edits` (image editing). Choose one way to set the output size: `--size WIDTHxHEIGHT` (area 655,360–20,000,000 px, aspect ratio 1:3–3:1), or `--aspect-ratio` plus `--area 1K|2K|4K` (default 4K). `--no-prompt-enhance` turns off prompt enhancement for text-to-image and then requires `--size` or a concrete `--aspect-ratio`. A failed image (for example one that fails the content safety check) does not stop the others; files keep their original position in the name and failures are reported on stderr (even with `--quiet`). With `--response-format base64`, the total output area (`n` × width × height) is limited to 20,000,000 px for png and 80,000,000 px for jpg/webp; with `size auto` each image counts as its `--area` level (4K = 4096 × 4096). Requests over the limit are rejected locally.

The H3-Image endpoints are not idempotent, so a retry after a timeout generates and bills again. The CLI never retries them automatically and raises the timeout for these requests to at least 600 seconds, matching the server. `--seed`, `--prompt-optimizer`, and `--subject-ref` apply only to image-01.

### `mmx video`

```bash
Expand Down
11 changes: 11 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,19 @@ cat messages.json | mmx text chat --messages-file - --output json
mmx image "一只穿宇航服的猫"
mmx image generate --prompt "科技感 Logo" --n 3 --aspect-ratio 16:9
mmx image generate --prompt "山水画" --out-dir ./output/

# MiniMax-H3-Image 文生图
mmx image generate --model MiniMax-H3-Image --prompt "一只橘猫趴在窗台上晒太阳,午后暖光,胶片质感" --aspect-ratio 16:9 --area 2K
mmx image generate --model MiniMax-H3-Image --prompt "极简海报" --size 2720x1536 --output-format png --n 2

# MiniMax-H3-Image 图像编辑(1~16 张参考图,按顺序对应图1、图2…)
mmx image generate --model MiniMax-H3-Image --prompt "把图1里的猫换成图2里的柴犬,保持背景不变" --image cat.jpg --image https://example.com/dog.png
```

MiniMax-H3-Image 不传 `--image` 时调用 `/v1/images/generations`(文生图),传 `--image` 时调用 `/v1/images/edits`(图像编辑)。输出尺寸二选一:`--size 宽x高`(面积 655,360~20,000,000 像素、宽高比 1:3~3:1),或 `--aspect-ratio` + `--area 1K|2K|4K`(默认 4K)。`--no-prompt-enhance` 可关闭文生图的 Prompt 增强,此时须指定 `--size` 或具体的 `--aspect-ratio`。单张失败(如未通过内容安全检查)不会中断其它图片,文件按原始张序命名,失败原因输出到 stderr(`--quiet` 时也会输出)。使用 `--response-format base64` 时,总输出面积(`n` × 宽 × 高)上限为 png 20,000,000 像素、jpg/webp 80,000,000 像素;`size` 为 auto 时每张按 `--area` 计(4K 按 4096 × 4096),超出会在本地直接报错。

H3-Image 接口不支持幂等,超时重试会重复生成并计费,因此 CLI 不会自动重试,并把该请求的超时下限设为 600 秒(与服务端一致)。`--seed`、`--prompt-optimizer`、`--subject-ref` 仅适用于 image-01。

### `mmx video`

```bash
Expand Down
23 changes: 23 additions & 0 deletions SDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,31 @@ const result = await sdk.image.generate({
height: 1024,
n: 1,
});

// MiniMax-H3-Image text-to-image → POST /v1/images/generations
const h3 = await sdk.image.generate({
model: 'MiniMax-H3-Image',
prompt: 'An orange cat basking on a windowsill',
aspect_ratio: '16:9',
area: '2K',
n: 2,
});
// Partial failures return 200; failed items only carry `error`.
h3.data.forEach((item, i) => console.log(i, item.url ?? item.error?.message));

// MiniMax-H3-Image image editing → POST /v1/images/edits (1-16 images)
const edited = await sdk.image.generate({
model: 'MiniMax-H3-Image',
prompt: 'Replace the cat in Picture 1 with the dog in Picture 2',
images: [{ image_url: 'https://example.com/cat.jpg' }, { image_url: 'mm_file://123' }],
});

// Save successful images; the extension follows output_format.
const paths = await sdk.image.save(edited, { outDir: './out' });
```

H3-Image requests are checked locally against the documented limits (size, aspect ratio, `n`, reference images, `b64_json` total area, 64 MiB request body) before sending. Passing `images` (even an empty list) always targets the edits endpoint. All H3-Image requests use a timeout of at least 600 seconds. The endpoints are not idempotent, so the SDK does not retry them. Streaming (`stream: true`) is not supported by the SDK.

### Video

```typescript
Expand Down
23 changes: 22 additions & 1 deletion skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ cat conversation.json | mmx text chat --messages-file - --output json

### image generate

Generate images. Model: `image-01`.
Generate images. Default model: `image-01`. Use `--model MiniMax-H3-Image` for higher-resolution text-to-image (up to 20 MP) or for image editing with `--image`.

```bash
mmx image generate --prompt <text> [flags]
Expand All @@ -104,6 +104,27 @@ mmx image generate --prompt <text> [flags]
| `--response-format <format>` | string | `url` (default) or `base64`. Base64 bypasses CDN download |
| `--out-dir <dir>` | string | Download images to directory |
| `--out-prefix <prefix>` | string | Filename prefix (default: `image`) |
| `--model <model>` | string | `image-01` (default), `image-01-live`, or `MiniMax-H3-Image`; other values go to the image-01 endpoint unchanged |

**MiniMax-H3-Image only** (`--seed`, `--prompt-optimizer`, `--subject-ref` are rejected; `--width/--height` become `--size`):

| Flag | Type | Description |
|---|---|---|
| `--image <path-or-url>` | string, repeatable | 1–16 reference images → image editing (`/v1/images/edits`). Order = Picture 1, 2, … |
| `--size <WxH>` | string | `auto` or e.g. `2720x1536`; area 655,360–20,000,000 px, ratio 1:3–3:1. Not with `--aspect-ratio`/`--area` |
| `--aspect-ratio <X:Y>` | string | `auto` (default) or X:Y (integers 1–300) between 1:3 and 3:1 |
| `--area <level>` | string | `1K`, `2K`, `4K` (default) |
| `--n <count>` | number | 1–10 |
| `--output-format <fmt>` | string | `jpg` (default), `png`, `webp` |
| `--output-compression <q>` | number | 0–100 (default 95), jpg/webp only |
| `--no-prompt-enhance` | boolean | Text-to-image only; needs `--size` or a concrete `--aspect-ratio` |

H3-Image is synchronous and **not idempotent** — do not re-run a command just because it was slow; each run is billed. Partial failures exit 0 with `failed_count`/`failures` in JSON output (failures are also printed to stderr, even with `--quiet`). With `--response-format base64`, the total area `n` × W × H is limited to 20 MP for png and 80 MP for jpg/webp (`size auto` counts the `--area` level, e.g. 4K = 4096×4096).

```bash
mmx image generate --model MiniMax-H3-Image --prompt "A cat on a windowsill" --aspect-ratio 16:9 --area 2K --output json --quiet
mmx image generate --model MiniMax-H3-Image --prompt "Put the hat from Picture 2 on the person in Picture 1" --image person.jpg --image hat.png --out result.jpg --quiet
```

```bash
mmx image generate --prompt "A cat in a spacesuit" --output json --quiet
Expand Down
8 changes: 8 additions & 0 deletions src/client/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ export function imageEndpoint(baseUrl: string): string {
return `${baseUrl}/v1/image_generation`;
}

export function imageGenerationsEndpoint(baseUrl: string): string {
return `${baseUrl}/v1/images/generations`;
}

export function imageEditsEndpoint(baseUrl: string): string {
return `${baseUrl}/v1/images/edits`;
}

export function videoGenerateEndpoint(baseUrl: string): string {
return `${baseUrl}/v1/video_generation`;
}
Expand Down
Loading
Loading