編集

Gemini 2.5 Flash Image GA

Gemini 2.5 Flash Imageが一般提供開始。10種類のアスペクト比と画像のみの出力に対応。

対応されたアスペクト比:

  • Landscape: 21:9, 16:9, 4:3, 3:2
  • Square: 1:1
  • Portrait: 9:16, 3:4, 2:3
  • Flexible: 5:4, 4:5

価格:$0.039/画像、$30.00/100万出力トークン

アスペクト比の指定および画像のみの出力方法:

python
from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-2.5-flash-image",
    contents=[prompt, image],
    config=types.GenerateContentConfig(
        response_modalities=["IMAGE"],
        image_config=types.ImageConfig(
            aspect_ratio="16:9",
        )
    )
)

#参考文献

編集