Zum Inhalt springen
Öffne CastalyKonsole

Bild

gemini-3.1-flash-image API

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

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

Schnittblumen verwandeln sich auf den Stahlregalen eines Kühlraums eines Floristen in mundgeblasenes Glas.

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

Parameter: size=2Kratio=16:9

Prompt: The cold room of a flower shop, steel shelves and buckets of cut stems. A figure in an acid-green vinyl coat has just pulled one bucket toward the door. Along that whole shelf the flowers have begun turning to blown glass, petal by petal, the transformation running outward from the bucket like frost: stems still green at the base, heads already clear and ringing, throwing hard coloured caustics across the steel. One hard pink light through the open cooler door, cold blue shade behind. Wide low camera, macro-sharp on the glass edges, real weight, film grain, no text.

Anfrage, die dieses Beispiel erstellt hat
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "The cold room of a flower shop, steel shelves and buckets of cut stems. A figure in an acid-green vinyl coat has just pulled one bucket toward the door. Along that whole shelf the flowers have begun turning to blown glass, petal by petal, the transformation running outward from the bucket like frost: stems still green at the base, heads already clear and ringing, throwing hard coloured caustics across the steel. One hard pink light through the open cooler door, cold blue shade behind. Wide low camera, macro-sharp on the glass edges, real weight, 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-3.1-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 512 / 1K / 2K / 4K

Flash Image unterstützt 512, 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-3.1-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-3.1-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 tokenbasierte Abrechnung. Den aktuellen Kundenpreis, den Referenzlistenpreis und die vollständige Spezifikation finden Sie auf der Modellpreisseite.

Medienvertrag · v1

Vertrags-ID: media.gemini-3-1-flash-image.v1Adapter: image.gemini.native.v1@v1Fingerabdruck: fb4adc579d570a2f8d4371edde0dc6bfa1042a004eb39641c63bd98fa4c7c8cc

Offizielle Quelle: Google

Vertragsparameter

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

Unterstützte Funktion

  • allowed_values · size · 512, 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": "512"
}

Anbieteranfrage

{
  "contents": [
    {
      "parts": [
        {
          "text": "A red paper kite over a quiet harbour at dusk."
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "512"
    },
    "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": "512"
}

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": "512"
    },
    "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."
      }
    ]
  }
}