# MiniMax H3 Image API Complete API reference for MiniMax H3 Image text-to-image and image editing models. ## Model Variants This API supports two model variants: | Model | ID | Description | |-------|-----|-------------| | **MiniMax H3 Image** | `minimax-h3-image` | Text-to-image generation | | **MiniMax H3 Image Edit** | `minimax-h3-image-edit` | Image editing with up to 16 reference images | ## Quick Comparison | Feature | MiniMax H3 Image | MiniMax H3 Image Edit | |---------|-----------------|----------------------| | Input | Text prompt | Image(s) + Text prompt | | Resolution Options | 1K, 2K, 4K | 1K, 2K, 4K | | Aspect Ratios | 15 options | 15 options | | Image Input | No | Required (1-16 images) | | Output Formats | PNG, JPEG, WEBP | PNG, JPEG, WEBP | ### Supported Aspect Ratios `1:1`, `1:2`, `2:1`, `1:3`, `3:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `9:21`, `21:9` Provide the ratio as separate numeric `width` and `height` values, not pixel dimensions. If both values are omitted, the ratio defaults to `1:1`; otherwise, provide both values using one of the supported integer pairs. ## MiniMax H3 Image (Text-to-Image) ### Endpoint ``` POST /api/v1/image/task ``` ### Authentication ``` Authorization: Bearer YOUR_API_KEY ``` ### Request Parameters #### Required | Parameter | Type | Description | |-----------|------|-------------| | `model_name` | string | Must be `"minimax-h3-image"` | | `prompt` | string | Image generation prompt, up to 5000 characters | | `resolution` | string | Output resolution: `"1k"`, `"2k"`, or `"4k"` | #### Optional | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `width` | number | `1` | Width ratio value (e.g., 16 for 16:9); provide with `height`. If both values are omitted, the ratio defaults to `1:1`; otherwise, provide both values using one of the supported integer pairs | | `height` | number | `1` | Height ratio value (e.g., 9 for 16:9); provide with `width`. If both values are omitted, the ratio defaults to `1:1`; otherwise, provide both values using one of the supported integer pairs | | `output_format` | string | `"png"` | Output image format: `"png"`, `"jpeg"`, or `"webp"` | **Note:** The width:height ratio must be one of the 15 supported ratios listed above. ### Example Request ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'minimax-h3-image', prompt: 'A serene mountain landscape at sunset', width: 16, height: 9, resolution: '2k', output_format: 'png' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## MiniMax H3 Image Edit (Image Editing) ### Endpoint ``` POST /api/v1/image/task ``` ### Request Parameters #### Required | Parameter | Type | Description | |-----------|------|-------------| | `model_name` | string | Must be `"minimax-h3-image-edit"` | | `prompt` | string | Description of desired edits, up to 5000 characters | | `image_url_list` | string[] | Array of reference image URLs (1-16 images). Supports JPG, PNG, WEBP, HEIC, and HEIF. Each side must be 128-8192 pixels, and the longer side must not exceed 4 times the shorter side | | `resolution` | string | Output resolution: `"1k"`, `"2k"`, or `"4k"` | #### Optional | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `width` | number | `1` | Width ratio value (e.g., 16 for 16:9); provide with `height`. If both values are omitted, the ratio defaults to `1:1`; otherwise, provide both values using one of the supported integer pairs | | `height` | number | `1` | Height ratio value (e.g., 9 for 16:9); provide with `width`. If both values are omitted, the ratio defaults to `1:1`; otherwise, provide both values using one of the supported integer pairs | | `output_format` | string | `"png"` | Output image format: `"png"`, `"jpeg"`, or `"webp"` | **Note:** The width:height ratio must be one of the 15 supported ratios listed above. ### Example Request ```javascript const response = await fetch('https://api.flaq.ai/api/v1/image/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'minimax-h3-image-edit', prompt: 'Change the sky to sunset colors', image_url_list: ['https://example.com/image.jpg'], width: 16, height: 9, resolution: '2k', output_format: 'png' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ### Single Image Edit Example ```javascript { model_name: 'minimax-h3-image-edit', prompt: 'Change the sky to sunset colors', image_url_list: ['https://example.com/image.jpg'], width: 16, height: 9, resolution: '2k', output_format: 'png' } ``` ### Multi-Image Composition Example ```javascript { model_name: 'minimax-h3-image-edit', prompt: 'Combine these images into a cohesive landscape', image_url_list: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg'], width: 16, height: 9, resolution: '2k', output_format: 'png' } ``` ## Response Format ### Initial Response ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/image/{task_id}", "task_status": "submitted" } } ``` ### Polling Response Poll `GET /api/v1/image/{task_id}` to check status. Successful polling responses expose generated image URLs under `data.task_result.images[].url`. ### Status Values - `submitted`: Task accepted - `processing`: Image generation in progress - `succeed`: Image generation completed - `failed`: Image generation failed ## Best Practices 1. **Detailed Prompts**: Describe the subject, lighting, and composition, keeping prompts within 5000 characters 2. **Resolution Selection**: Pass `1k`, `2k`, or `4k` explicitly in every request 3. **Aspect Ratio**: Use paired ratio values for `width` and `height`, or omit both for `1:1` 4. **Image Edit Quality**: Provide 1-16 reference images that meet the supported format and dimension requirements