Zum Inhalt springen
Öffne CastalyKonsole

Bild

gemini-2.5-flash-image API

Rufen Sie gemini-2.5-flash-image über Modelflare mit der genauen Modell-ID auf, die auf dieser Seite angezeigt wird.

Verwenden Sie die genaue Modell-ID gemini-2.5-flash-image. Das Modellfeld muss genau mit dieser Seite übereinstimmen.

Farbchipkarten werden aus dem Regal gehoben und in eine violett-orangefarbene Farbverlaufswand einsortiert.

Beispielausgabegemini-2.5-flash-imagePOST /v1beta/models/gemini-2.5-flash-image:generateContent

Parameter: size=2Kratio=16:9

Prompt: 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.

Anfrage, die dieses Beispiel erstellt hat
{
"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"
}
}
}

Verwenden Sie einen Modelflare-API-Schlüssel mit https://modelflare.dev. Der Gateway-Einstiegspunkt ist POST /v1/models/{model}:generateContent.

HTTP
Authorization: Bearer YOUR_MODELFLARE_API_KEY
Terminal-Fensterbash
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": "A white cat runs through a neon-lit street in the rain"}]}],
"generationConfig": {"responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "16:9", "imageSize": "1K"}}
}'

Gemini-Bildmodelle verwenden natives contents und generationConfig; Bearbeitungen senden die Textanweisung und inline_data im selben parts[].

Gemini-Bildmodelle verwenden natives Gemini generateContent. Platzieren Sie Text und Referenzbilder im selben contents[].parts[]; Bilder verwenden inline_data. Senden Sie diese Modelle nicht an /v1/images/generations, /v1/images/edits oder OpenAI /v1/responses. Die imageSize-Enumeration ist modellspezifisch und wird unten angezeigt.

Feld Erforderlich Notizen
contents[].parts[].text Ja Textaufforderung oder Bearbeitungsanweisung
contents[].parts[].inline_data Nein Base64-Bilddaten und MIME-Typ
contents[].parts[].inline_data.mime_type Nein image/jpeg / image/png / image/webp
contents[].parts[].inline_data.data Nein Base64-codierter Referenzbildinhalt
generationConfig.responseModalities Ja ["IMAGE"] oder ["TEXT", "IMAGE"]
generationConfig.imageConfig.aspectRatio Nein 1:1 / 4:3 / 3:4 / 16:9 / 9:16
generationConfig.imageConfig.imageSize Nein 1K / 2K / 4K

Gemini 2.5 Flash Image unterstützt 1K, 2K und 4K mit 1:1, 4:3, 3:4, 16:9 und 9:16. In der offiziellen Dokumentation wird keine Obergrenze für die Anzahl der Referenzbilder veröffentlicht, sodass das Gateway keine lokale Obergrenze hinzufügt.

Platzieren Sie die Bearbeitungsanweisung und das Referenzbild im selben contents[].parts[]. inline_data.data ist der Base64-Bildinhalt; Senden Sie keine Gemini-Bildmodelle an die OpenAI-Images- oder Responses-Endpunkte.

Terminal-Fensterbash
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"}}
}'

Lesen candidates[].content.parts[]; Gehen Sie nicht davon aus, dass es sich bei jedem Teil um ein Bild handelt, da die Antwort möglicherweise Text- und Bildteile zusammen enthält.

Feld Notizen
candidates[].content.parts[].inline_data Generierter Bild-MIME-Typ und Base64-Daten
candidates[].content.parts[].text Textbeschriftung wurde zurückgegeben, als TEXT angefordert wurde
candidates[].finishReason Abschluss oder Sicherheitsgrund
usageMetadata Verwendung des Eingabe-/Ausgabe-Tokens bei Rückgabe durch den Dienst

Modelflare behält die native Gemini-Antwortform für gemini-2.5-flash-image bei und behält verwendbare Bildteile bei.

Feldfehler, Größen-/Verhältnisbeschränkungen und Sicherheitsverweigerungen aus der nativen Gemini-Anfrage bleiben Gemini-kompatible Fehlerantworten. Das Gateway schreibt sie nicht als OpenAI Images-Antworten um.

Auf dieser Seite werden Modelflare-Modellgenerierungs- und -bearbeitungsaufrufe behandelt. Such- oder Kartenanreicherung, Sprachverwaltung und Elementbibliotheksverwaltung sind Ressourcen-APIs außerhalb dieser öffentlichen Modellaufrufoberfläche und keine erforderlichen Anforderungsfelder.

Dieses Modell verwendet eine Abrechnung pro Anruf. Den aktuellen Kundenpreis, den Referenzlistenpreis und die vollständige Spezifikation finden Sie auf der Modellpreisseite.

Medienvertrag · v1

Vertrags-ID: media.gemini-2-5-flash-image.v1Adapter: image.gemini.native.v1@v1Fingerabdruck: 240c1369048275e3ae3ec16db479ebda38b31af481c1ca118c04ae0f23d66ead

Offizielle Quelle: Google

Vertragsparameter

AbsichtsfeldSteuerelementOptionen
sizeselect1K / 2K / 4K
ratioselect1:1 / 4:3 / 3:4 / 16:9 / 9:16

Unterstützte Funktion

  • allowed_values · size · 1K, 2K, 4K
  • allowed_values · ratio · 1:1, 4:3, 3:4, 16:9, 9:16

Beispiel für eine strukturierte Anfrage

text

Absicht

{
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "ratio": "1:1",
  "size": "1K"
}

Anbieteranfrage

{
  "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

Absicht

{
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "ratio": "1:1",
  "size": "1K"
}

Anbieteranfrage

{
  "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."
      }
    ]
  }
}