vercel 5天前 · 2026-11-18 09:49:11 · 7 阅读
MAI-Image-2.7 和 MAI-Image-2.7-Flash 现已在 AI Gateway 上上线
微软的 MAI-Image-2.7 和 MAI-Image-2.7-Flash 现已在 AI Gateway 上开放公测。两款模型均将最大输出分辨率提升至 2048 x 2048 像素,并支持为生成及编辑后的图片添加透明背景。
使用一个 AI Gateway API 密钥即可通过文本生成图片或编辑现有图片,无需微软账户。两款模型均支持照片级真实图像、文字渲染以及对产品、人像和版式的针对性编辑。用户最多可使用五张参考图来引导编辑或合成多个主体。
MAI-Image-2.7 (
microsoft/mai-image-2.7):适用于对图像质量有较高要求的最终交付资产MAI-Image-2.7-Flash (
microsoft/mai-image-2.7-flash):适用于探索提示词或快速创建变体时,追求更低延迟和成本
设置 AI_GATEWAY_API_KEY 环境变量后,可配合 AI SDK 6 或更高版本 使用上述任一模型 ID。若需生成透明 PNG,请将 providerOptions.azure.background 设为 'transparent':
若要编辑图片,将其作为参考提供,并描述所需修改:
AI SDKAI SDKAI SDKAI SDK1import { generateImage } from 'ai';2import { readFileSync, writeFileSync } from 'node:fs';3
4const { image } = await generateImage({5 model: 'microsoft/mai-image-2.7-flash',6 prompt: {7 text: 'Place the bottle on a marble counter',8 images: [readFileSync('bottle.png')],9 },10});11
12writeFileSync('counter.png', image.uint8Array);Copy for agent查看模型详情 ↗你还可以通过 AI CLI 在终端中生成和编辑图片,使用相同的 API 密钥和模型 ID:
AI CLIAI CLIAI CLIAI CLI1npm install -g ai-cli2ai image -m microsoft/mai-image-2.7 --size 2048x2048 -o bottle.png "A glass perfume bottle, studio product shot"3ai image -m microsoft/mai-image-2.7-flash -i bottle.png -o counter.png "Place the bottle on a marble counter"
复制给智能体查看模型详情 ↗在模型 Playground 中试用 MAI-Image-2.7 或 MAI-Image-2.7-Flash,也可以参考图像生成指南。
原始来源: vercel