画像
gemini-2.5-flash-image API
このページに表示されている正確なモデル ID を使用して、Modelflare を通じて gemini-2.5-flash-image を呼び出します。
正確なモデル ID gemini-2.5-flash-image を使用します。モデル フィールドはこのページと正確に一致する必要があります。

パラメータ: size=2Kratio=16:9
プロンプト: The paint aisle of a hardware store, fluorescent tubes and rows of colour chip cards. A woman in a chrome puffer coat has just run one hand along the rack. Every card she touched has lifted off its peg and the whole aisle is filling with them, thousands of paper chips turning in the air and sorting themselves into a single smooth gradient wall from deep violet to hot orange. Cold fluorescent ambient, one hard warm slash of light from the end of the aisle. Wide low camera down the aisle, paper edges catching the light, film grain, no text.
{ "contents": [ { "role": "user", "parts": [ { "text": "The paint aisle of a hardware store, fluorescent tubes and rows of colour chip cards. A woman in a chrome puffer coat has just run one hand along the rack. Every card she touched has lifted off its peg and the whole aisle is filling with them, thousands of paper chips turning in the air and sorting themselves into a single smooth gradient wall from deep violet to hot orange. Cold fluorescent ambient, one hard warm slash of light from the end of the aisle. Wide low camera down the aisle, paper edges catching the light, film grain, no text." } ] } ], "generationConfig": { "responseModalities": [ "IMAGE" ], "imageConfig": { "aspectRatio": "16:9", "imageSize": "2K" } }}認証とエンドポイント
Section titled “認証とエンドポイント”https://modelflare.dev で Modelflare API キーを使用します。ゲートウェイのエントリ ポイントは POST /v1/models/{model}:generateContent です。
Authorization: Bearer YOUR_MODELFLARE_API_KEYcurl "https://modelflare.dev/v1/models/gemini-2.5-flash-image:generateContent" \ -H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [{"role": "user", "parts": [{"text": "A white cat runs through a neon-lit street in the rain"}]}], "generationConfig": {"responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "16:9", "imageSize": "1K"}} }'リクエストメモ
Section titled “リクエストメモ”Gemini イメージ モデルはネイティブ contents および generationConfig を使用します。編集では、テキスト指示と inline_data を同じ parts[] で送信します。
リクエストパラメータ
Section titled “リクエストパラメータ”Gemini イメージ モデルはネイティブ Gemini generateContent を使用します。テキストと参照画像を同じ contents[].parts[] に配置します。画像はinline_dataを使用しています。これらのモデルを /v1/images/generations、/v1/images/edits、または OpenAI /v1/responses に送信しないでください。 imageSize 列挙型はモデル固有であり、以下に示します。
| フィールド | 必須 | 注意事項 |
|---|---|---|
contents[].parts[].text |
はい | テキストプロンプトまたは編集指示 |
contents[].parts[].inline_data |
いいえ | Base64画像データとMIMEタイプ |
contents[].parts[].inline_data.mime_type |
いいえ | image/jpeg / image/png / image/webp |
contents[].parts[].inline_data.data |
いいえ | Base64 でエンコードされた参照画像コンテンツ |
generationConfig.responseModalities |
はい | ["IMAGE"]または["TEXT", "IMAGE"] |
generationConfig.imageConfig.aspectRatio |
いいえ | 1:1 / 4:3 / 3:4 / 16:9 / 9:16 |
generationConfig.imageConfig.imageSize |
いいえ | 1K / 2K / 4K |
応答および入力制限
Section titled “応答および入力制限”Gemini 2.5 Flash Image は、1K、2K、4K と 1:1、4:3、3:4、16:9、9:16 をサポートします。公式ドキュメントでは参照イメージ数の上限が公開されていないため、ゲートウェイはローカルの上限を追加しません。
編集指示と参照画像を同じcontents[].parts[]に入れます。 inline_data.data は Base64 画像コンテンツです。 Gemini イメージ モデルを OpenAI イメージまたは Responses エンドポイントに送信しないでください。
curl "https://modelflare.dev/v1/models/gemini-2.5-flash-image:generateContent" \ -H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [{"role": "user", "parts": [ {"text": "Keep the subject and lighting, but replace the background with a misty pine forest."}, {"inline_data": {"mime_type": "image/jpeg", "data": "BASE64_IMAGE_DATA"}} ]}], "generationConfig": {"responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}} }'candidates[].content.parts[] を読み取ります。応答にはテキスト部分と画像部分が一緒に含まれる可能性があるため、すべての部分が画像であると想定しないでください。
| フィールド | 注意事項 |
|---|---|
candidates[].content.parts[].inline_data |
生成された画像の MIME タイプと Base64 データ |
candidates[].content.parts[].text |
TEXT が要求されたときにテキスト キャプションが返されました |
candidates[].finishReason |
完了または安全上の理由 |
usageMetadata |
サービスによって返されたときの入出力トークンの使用法 |
Modelflare は、gemini-2.5-flash-image のネイティブ Gemini 応答形状を保存し、使用可能な画像部分を保持します。
エラーと失敗したタスク
Section titled “エラーと失敗したタスク”ネイティブ Gemini リクエストからのフィールド エラー、サイズ/比率制限、および安全性の拒否は、Gemini 互換のエラー応答のままです。ゲートウェイはそれらを OpenAI Images 応答として書き換えません。
サポート範囲
Section titled “サポート範囲”このページでは、Modelflare モデルの生成と編集呼び出しについて説明します。検索またはマップのエンリッチメント、音声管理、および要素ライブラリ管理は、このパブリック モデル呼び出しサーフェスの外部にあるリソース API であり、必須のリクエスト フィールドではありません。
価格設定と請求
Section titled “価格設定と請求”通話ごとの課金を採用するモデルです。現在の顧客価格、参考定価、完全な仕様については、モデル価格ページを参照してください。
メディア契約 · v1
公式ソース: Google
契約パラメータ
| インテントフィールド | コントロール | オプション |
|---|---|---|
size | select | 1K / 2K / 4K |
ratio | select | 1:1 / 4:3 / 3:4 / 16:9 / 9:16 |
サポートされる機能
allowed_values·size· 1K, 2K, 4Kallowed_values·ratio· 1:1, 4:3, 3:4, 16:9, 9:16
構造化リクエストの例
text
インテント
{
"prompt": "A red paper kite over a quiet harbour at dusk.",
"ratio": "1:1",
"size": "1K"
}プロバイダーリクエスト
{
"contents": [
{
"parts": [
{
"text": "A red paper kite over a quiet harbour at dusk."
}
],
"role": "user"
}
],
"generationConfig": {
"imageConfig": {
"aspectRatio": "1:1",
"imageSize": "1K"
},
"responseModalities": [
"TEXT",
"IMAGE"
]
},
"systemInstruction": {
"parts": [
{
"text": "Generate an image for the user's request. If details are missing, choose reasonable defaults and still return an image. Do not ask clarifying questions."
}
]
}
}reference
インテント
{
"prompt": "A red paper kite over a quiet harbour at dusk.",
"ratio": "1:1",
"size": "1K"
}プロバイダーリクエスト
{
"contents": [
{
"parts": [
{
"text": "A red paper kite over a quiet harbour at dusk."
},
{
"inline_data": {
"data": "AAAA",
"mime_type": "image/png"
}
}
],
"role": "user"
}
],
"generationConfig": {
"imageConfig": {
"aspectRatio": "1:1",
"imageSize": "1K"
},
"responseModalities": [
"TEXT",
"IMAGE"
]
},
"systemInstruction": {
"parts": [
{
"text": "Generate an image for the user's request. If details are missing, choose reasonable defaults and still return an image. Do not ask clarifying questions."
}
]
}
}