curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.7-flash/text-to-image",
"input": {
"prompt": "A ceramic teapot on a linen tablecloth, soft window light, the label reads \"Morning Ritual\""
}
}
'{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "not_started",
"created_time": "2026-11-19T10:30:00"
}
}{
"detail": "prompt is required"
}{
"detail": "prompt is required"
}Microsoft
MAI Image 2.7 Flash 文生图
MAI Image 2.7 Flash 文生图 API 根据提示词快速生成一张 1K 或 2K 图片,支持 7 种宽高比、最高 400 万像素的自定义尺寸和透明输出。
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "microsoft/mai-image-2.7-flash/text-to-image",
"input": {
"prompt": "A ceramic teapot on a linen tablecloth, soft window light, the label reads \"Morning Ritual\""
}
}
'{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "not_started",
"created_time": "2026-11-19T10:30:00"
}
}{
"detail": "prompt is required"
}{
"detail": "prompt is required"
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
模型
- microsoft/mai-image-2.7-flash/text-to-image — MAI Image 2.7 Flash 文生图,每次一张图片。
功能
- 7 种宽高比预设,
1K(约 100 万像素)或2K(约 400 万像素)。 - 自定义
WIDTHxHEIGHT尺寸,最多 4,194,304 像素。 - 透明背景;PNG、JPEG 或 WebP 输出。
- 提示词最多 32,000 个字符。
必填参数
prompt(string):图片描述。1–32,000 个字符的文本。图中需要出现的文字请放在引号里。
可选参数
size(string):宽高比预设或自定义WIDTHxHEIGHT。默认1:1。参见尺寸。resolution(string):1K或2K。默认1K。只对宽高比预设生效。background(string):opaque或transparent。默认opaque。transparent要求output_format为png或webp。output_format(string):png、jpeg或webp。默认png。
尺寸
- 预设:
1:1、4:3、3:4、3:2、2:3、16:9、9:16,按所选resolution出图:1K约 100 万像素(1:1为 1024x1024),2K约 400 万像素(16:9为 2720x1536)。 - 自定义
WIDTHxHEIGHT(用x或X,例如3072x1344):两边都必须是 16 的倍数,每边至少 768 像素,总像素最多 4,194,304。图片按给定尺寸原样输出,其他自定义值返回 400。resolution用于比例预设。
示例
- 1K 方图:带引号标签文字的产品静物,使用默认参数。
- 2K 16:9:约 400 万像素(2720x1536)的风景图。
- 透明抠图:自定义
3072x1344,background: transparent,WebP。
注意事项
- 每次请求返回一张图片。
input接收上文列出的字段,其他字段返回 400。model和callback_url放在请求根级,与input并列。 background: transparent搭配output_format: jpeg会返回 400。- 使用参考图编辑请用 MAI Image 2.7 Flash 图像编辑。
- 按 token 计费:提示词文本 token 和输出图片 token(输出宽 × 高 / 1024)。价格随输出尺寸变化,
2K和更大的自定义尺寸费用更高。提交时按本次请求的上限预扣,任务完成后按实际输出尺寸结算,最多为预扣金额,多余部分退还。任务失败会全额退还。当前费率见定价页。
请求体
application/json