Newshot

MAI-Image-2.7 与 MAI-Image-2.7-Flash 现已在 AI Gateway 上线

AI summary

微软的 MAI-Image-2.7 与 MAI-Image-2.7-Flash 已在 AI Gateway 上开放公开预览,两者都将最大输出尺寸提升至 2048 x 2048 像素,并为生成和编辑的图像新增透明背景。只需一个 AI Gateway API key 即可从文本生成图像或编辑现有图像,无需 Microsoft 账户;两款模型均支持照片级图像、文字渲染,以及对产品、人像和版面的定向编辑,并可使用最多五张参考图像来引导编辑或组合主体。MAI-Image-2.7 适合对图像质量优先的最终素材,MAI-Image-2.7-Flash 则适合探索提示词或创建变体时更快、成本更低的生成。

Translation(model translation, not the source's own text)
题图
题图

Microsoft 的 MAI-Image-2.7 与 MAI-Image-2.7-Flash 现已在 AI Gateway 上提供公开预览。两者都将最大输出尺寸提升至 2048 x 2048 像素,并为生成和编辑的图像新增了透明背景。

只需一个 AI Gateway API key,无需 Microsoft 账户,即可从文本生成图像或编辑现有图像。两个模型均支持照片级真实图像、文字渲染,以及对产品、人像和版面的定向编辑。最多可使用五张参考图像来引导编辑或组合主体。

  • MAI-Image-2.7 (microsoft/mai-image-2.7):适用于图像质量优先的最终素材
  • MAI-Image-2.7-Flash (microsoft/mai-image-2.7-flash):适用于探索提示词或创建变体时更快、成本更低的生成

设置 AI_GATEWAY_API_KEY 环境变量,然后将任一模型 ID 与 AI SDK 6 或更高版本配合使用。要生成透明 PNG,请将 providerOptions.azure.background 设置为 'transparent':


        import { generateImage } from 'ai';import { writeFileSync } from 'node:fs';
const { image } = await generateImage({  model: 'microsoft/mai-image-2.7',  prompt: 'A glass perfume bottle, studio product shot',  size: '2048x2048',  providerOptions: {    azure: { background: 'transparent' },  },});
writeFileSync('bottle.png', image.uint8Array);
      

要编辑图像,请将其作为参考传入,并描述需要更改的内容:


        import { generateImage } from 'ai';import { readFileSync, writeFileSync } from 'node:fs';
const { image } = await generateImage({  model: 'microsoft/mai-image-2.7-flash',  prompt: {    text: 'Place the bottle on a marble counter',    images: [readFileSync('bottle.png')],  },});
writeFileSync('counter.png', image.uint8Array);
      

你也可以在终端中使用 AI CLI,通过相同的 API key 和模型 ID 来生成和编辑图像:


        npm install -g ai-cliai image -m microsoft/mai-image-2.7 --size 2048x2048 -o bottle.png "A glass perfume bottle, studio product shot"ai image -m microsoft/mai-image-2.7-flash -i bottle.png -o counter.png "Place the bottle on a marble counter"
      

在 model playground 中试用 MAI-Image-2.7 或 MAI-Image-2.7-Flash,或参阅图像生成指南。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by Vercel Blog
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗