Zum Inhalt springen
Öffne CastalyKonsole

Bild

gemini-3.1-flash-lite-image API

Rufen Sie gemini-3.1-flash-lite-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-lite-image. Das Modellfeld muss genau mit dieser Seite übereinstimmen.

Dampfgeflecht in korallenroten und violetten Bändern über einer Nudeltheke bis spät in die Nacht.

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

Parameter: ratio=16:9

Prompt: A late-night noodle counter, six stools and a steel pass, rain on the window behind. A cook in an orange quilted jacket has just lifted the lid off a stock pot. The steam is not dispersing: it has gathered into solid braided ribbons of coral and ultraviolet that rope up past her face and press flat along the ceiling. One hard tungsten bulb directly overhead, the street outside cold and blue. Wide camera at counter height, real density in the steam, film grain, slight vignette, no text.

Anfrage, die dieses Beispiel erstellt hat
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "A late-night noodle counter, six stools and a steel pass, rain on the window behind. A cook in an orange quilted jacket has just lifted the lid off a stock pot. The steam is not dispersing: it has gathered into solid braided ribbons of coral and ultraviolet that rope up past her face and press flat along the ceiling. One hard tungsten bulb directly overhead, the street outside cold and blue. Wide camera at counter height, real density in the steam, film grain, slight vignette, no text."
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
],
"imageConfig": {
"aspectRatio": "16:9"
}
}
}

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-lite-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 / 3:2 / 2:3 / 3:4 / 4:3 / 4:5 / 5:4 / 9:16 / 16:9 / 21:9
generationConfig.imageConfig.imageSize Nein 1K

Lite unterstützt nur 1K mit 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 und 21:9. Die offizielle Dokumentation veröffentlicht keine Obergrenze für die Anzahl der Referenzbilder, daher fügt das Gateway keine lokale Obergrenze hinzu und gibt den Dienstfehler zurück, wenn das Dienstlimit überschritten wird.

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-lite-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-lite-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-lite-image.v1Adapter: image.gemini.native.v1@v1Fingerabdruck: 3eb181032c0d879a99b4c879c0ee28f714c72bf3d9c228ccc50eb61a3778b79e

Offizielle Quelle: Google

Vertragsparameter

AbsichtsfeldSteuerelementOptionen
sizeselect1K
ratioselect1:1 / 3:2 / 2:3 / 3:4 / 4:3 / 4:5 / 5:4 / 9:16 / 16:9 / 21:9

Unterstützte Funktion

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

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