Skip to main content
POST
手順を追った例については、Gemini 画像モデルを使うを参照してください。
Google による画像モデルと generateContent の更新に伴い、Gemini の画像生成オプションは変更される場合があります。最新の完全なパラメータ一覧とプロバイダー固有の動作については、Gemini の画像生成ドキュメントを確認してください。
gemini-2.5-flash-image は、2026-10-02 にプロバイダーによって提供終了となる予定です。新規プロジェクトでは、gemini-3.1-flash-image-preview または gemini-3-pro-image-preview を使用してください。詳細は、Google の非推奨スケジュールを参照してください。
Gemini の画像レスポンスには、thoughttrue の中間画像パーツが含まれることがあります。これらは最終出力ではありません。生成された画像を保存する際は、thought: true のパーツをスキップし、inlineData が存在し、thoughttrue ではない最後の画像パーツを使用してください。

承認

Authorization
string
header
必須

Use your CometAPI API key.

パスパラメータ

model
string
デフォルト:gemini-3.1-flash-image-preview
必須

The Gemini image model to use. See the Models page for current options.

ボディ

application/json
contents
object[]
必須

Conversation turns. Each item has a role ("user" or "model") and parts array containing text and/or image data.

generationConfig
object

Controls generation behavior — output modalities, image resolution, thinking, etc.

tools
object[]

Optional tools. Pass [{"google_search": {}}] to enable Google Search grounding for real-time information in generated images.

レスポンス

200 - application/json

Success

candidates
object[]
usageMetadata
object