MAI-Image-2.6 Image Generation
Text-to-image, single-image editing, composition with up to 5 reference images, and web grounding. Available in high-quality and Flash versions.
全部文档/v1/images/generations请求示例
curl --request POST \
--url https://api.apisea.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "mai-image-2.6",
"prompt": "A photorealistic poster of a university campus at sunset, cinematic lighting",
"size": "16:9",
"resolution": "2K"
}'Model selection
| Model ID | Features |
|---|---|
mai-image-2.6 | High-quality version for quality-focused use cases |
mai-image-2.6-flash | Faster, lower-cost version with slightly lower image quality |
Both models share the same capabilities and parameters and generate only 1 image per request. Refer to model pricing for actual prices.
Note
This endpoint is asynchronous. Retrieve the task ID from
data[0].task_idafter submission, then use task queries for results. Poll every 3–5 seconds with an overall wait timeout of 3 minutes. Stop when the status iscompletedorfailed.
Request headers
AuthorizationstringrequiredBearer authentication in the format Bearer <token>, where <token> is your APISea API Key.
Request parameters
modelstringrequiredModel ID: mai-image-2.6 or mai-image-2.6-flash.
nsfw_checkbooleandefault: falseWhether to run content moderation before submitting the image task.
true: useomni-moderation-latestto review prompts and input imagesfalseor omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequiredImage description or editing instructions. Supports Chinese and English, up to approximately 32,000 tokens (not characters).
sizestringdefault: 1:1Accepts an aspect ratio (such as 16:9), pixel dimensions (such as 1536x1024), or auto.
- Aspect ratio: any integer ratio from
1:4to4:1, used together withresolution. - Pixel dimensions: accepts
widthxheight,width*height, orwidth×height. In this mode,resolutiondoes not determine dimensions. auto: the model selects an aspect ratio based on the prompt.
Text-to-image only. When reference images are provided, the model determines output dimensions.
resolutionstringdefault: 1KSupports 1K and 2K, including lowercase. Other tiers such as 4K are unsupported and return HTTP 400.
For text-to-image with an aspect ratio, this parameter selects the size tier. It does not determine dimensions when exact pixels are used. It cannot set image-to-image output dimensions.
widthintegerExact pixel width. Must be provided together with height. This pair takes precedence over size and resolution for text-to-image dimensions.
Both width and height must be at least 768, with no more than 2,359,296 total pixels. Use multiples of 32; otherwise each output dimension is rounded down to a multiple of 32.
This parameter does not determine image-to-image output dimensions.
heightintegerExact pixel height. Must be provided together with width and follows the constraints above. Does not determine image-to-image output dimensions.
image_urlsstring[]Reference image list, up to 5 images. Omit for text-to-image; provide one for single-image editing or multiple for composition.
Each entry supports a publicly accessible HTTP(S) image URL or a Base64 Data URL such as data:image/png;base64,....
JPEG and PNG are supported; WEBP and GIF are automatically converted to PNG. Image URLs must be publicly accessible or the task will fail.
Image-to-image output dimensions are determined by the model from the references, at about 1 million pixels with a similar aspect ratio. size, resolution, width, and height cannot set these dimensions.
auto_aspect_ratiobooleandefault: falseSet to true to let the model choose an aspect ratio based on the prompt, equivalent to size: "auto".
web_groundingbooleandefault: falseSet to true to retrieve real-time information before generation, useful for images involving real people, places, or events.
nintegerdefault: 1Only 1 is supported. Submit separate tasks for multiple images. Values above 1 return HTTP 400.
Text-to-image dimensions
| Requirement | Parameters |
|---|---|
| Default square | Omit size parameters: 1:1 + 1K, producing 1024×1024 |
| Resolution tier + aspect ratio | size: "16:9", resolution: "2K" |
| Exact pixels | size: "1536x1024", or width: 1536, height: 1024 |
| Automatic aspect ratio | size: "auto" or auto_aspect_ratio: true |
Text-to-image dimension precedence: paired width / height → exact-pixel size → aspect-ratio size combined with resolution.
Resolution tiers and aspect ratios
| Aspect ratio | 1K | 2K |
|---|---|---|
| 1:1 | 1024×1024 | 1536×1536 |
| 4:3 / 3:4 | 1152×864 / 864×1152 | 1760×1312 / 1312×1760 |
| 3:2 / 2:3 | 1248×832 / 832×1248 | 1856×1248 / 1248×1856 |
| 16:9 / 9:16 | 1344×768 / 768×1344 | 2048×1152 / 1152×2048 |
| 2:1 / 1:2 | 1536×768 / 768×1536 | 2144×1056 / 1056×2144 |
| 21:9 / 9:21 | 1792×768 / 768×1792 | 2336×992 / 992×2336 |
| 4:1 / 1:4 | 3072×768 / 768×3072 | 3072×768 / 768×3072 |
Dimensions are converted to multiples of 32. Since the shorter side must be at least 768, extreme aspect ratios can exceed approximately 1 million pixels even at 1K. Billing uses the token count corresponding to the actual output pixels.
Exact-pixel constraints
- Both width and height must be at least 768.
- Width × height must not exceed 2,359,296 (1536 × 1536).
- Each dimension is rounded down to a multiple of 32. For example,
1000x1000produces992x992. Use multiples of 32 for exact dimensions.
Dimensions such as 1536x1024, 2048x1152, and 3072x768 are supported. 512x512 is rejected because the sides are too small; 2048x2048 exceeds the total pixel limit.
Warning
The maximum applies to total pixels, not a 1536 limit on each side. Therefore,
2048x1152and3072x768are valid, but the 4K tier is unsupported. These dimension settings apply only to text-to-image.
Request examples
Exact pixels and web grounding
{
"model": "mai-image-2.6-flash",
"prompt": "The Eiffel Tower at night with fireworks, travel poster style",
"width": 2048,
"height": 1152,
"web_grounding": true
}Single-image editing
{
"model": "mai-image-2.6",
"prompt": "Make the bicycle blue and add a small dog next to it",
"image_urls": ["https://example.com/bicycle.png"]
}Multi-image composition
{
"model": "mai-image-2.6-flash",
"prompt": "Combine both reference images into a clean futuristic product photo",
"image_urls": [
"https://example.com/first.png",
"https://example.com/second.jpg"
]
}Replace the example image URLs with accessible URLs.
Unsupported parameters
quality, style, background, output_format, response_format, and mask_url are unsupported and ignored if provided. Output is always PNG. Mask-based editing is not supported.
Submission response
codeintegerResponse status code. 200 indicates success.
dataarrayTask submission result.
Show task fields
statusstringsubmitted indicates successful submission, not completed generation.
task_idstringTask ID used to query status and results.
Query task results
curl --request GET \
--url https://api.apisea.ai/v1/tasks/task_01K... \
--header 'Authorization: Bearer <token>'Example success response (the image URL is a placeholder):
{
"code": 200,
"data": {
"id": "task_01K...",
"status": "completed",
"progress": 100,
"result": {
"images": [
{
"url": ["https://example.com/generated-image.png"]
}
]
}
}
}| Status | Action |
|---|---|
pending | Queued; continue polling |
processing | Processing; continue polling |
completed | Success; get image links from the data.result.images[0].url array |
failed | Failure; read data.error.message and stop polling. Full refund |
Billing
Billed by actual input and output token usage. Refer to model pricing for unit prices.
- Image output tokens = actual output width × height ÷ 1024. For example, 1024×1024 corresponds to 1024 tokens; 1536×1536 to 2304 tokens.
- Input tokens per reference image are approximately its width × height ÷ 1024. Text prompts also count toward input usage.
- An amount based on the tier is charged upfront, then adjusted after success to actual token usage with a refund or additional charge.
- Failed tasks receive an automatic full refund. Parameter errors rejected at submission create no task and incur no charge.
Common errors
| HTTP | Cause and action |
|---|---|
| 400 | Unsupported resolution, such as 4K; use 1K or 2K |
| 400 | Width or height below 768, or total pixels above 2,359,296 |
| 400 | Only width or height provided; both are required together |
| 400 | Aspect ratio outside 1:4 to 4:1, or unrecognized size format |
| 400 | n above 1, or more than 5 reference images |
If a task fails, check image download or content safety errors. Revise the prompt or references before retrying. Editing photorealistic images involving minors may be blocked by content safety policies.
响应
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K..."
}
]
}使用此 endpoint 的模型
发现文档中的问题?请发送邮件至 support@apisea.ai。