PeumeAPI

AI generation · Gemini

Google: Gemini 3.1 Flash Image (Nano Banana 2)

Generate or edit one image with Gemini 3.1 Flash Image at 512px, 1K, 2K or 4K on Google's own API, from a prompt and optional reference images; the image returns inline as base64.

$0.248 per lookup, only when foundUsually answers in under a minute

Call it

curl https://api.peume.com/v1/call/google-gemini-3-1-flash-image-nano-banana-2 \
  -H "Authorization: Bearer $PEUME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "fields": "candidates(content(parts(text,inlineData)),finishReason),usageMetadata,modelVersion,responseId,promptFeedback",
    "model": "gemini-3.1-flash-image",
    "contents": [
      {
        "parts": [
          {
            "text": "A clean editorial illustration of a paper airplane."
          }
        ]
      }
    ],
    "generationConfig": "your generationConfig"
  }
}'

Answer: {"id": "run_…", "status": "completed", "cost_usd": …, "output": {…}}. Long jobs answer 202 with a run id to read later. From an AI agent, connect the MCP server and ask for this by name: google-gemini-3-1-flash-image-nano-banana-2.

Parameters

fieldsstring

Google's partial-response mask; the example drops the multi-megabyte thoughtSignature. Keep usageMetadata in any mask you send.

Example: candidates(content(parts(text,inlineData)),finishReason),usageMetadata,modelVersion,responseId,promptFeedback

modelRequiredstring

's key runs gemini-3.1-flash-image, the stable model, or its -preview alias, the same model at the same price; your own key can name another model.

Example: gemini-3.1-flash-image

contentsRequiredarray

One user turn: {parts: [{text: prompt},...references]}. A reference image is {fileData: {mimeType: image/png, fileUri: <public https URL>}} (Google fetches it; ` host <file>` prints a URL that works) or {inlineData: {mimeType, data: <base64>}}.

Example: [{"parts":[{"text":"A clean editorial illustration of a paper airplane."}]}]

generationConfigRequiredobject

Start free · $1 of calls included

Every API your product needs. One key.

7,267 endpoints, one bill, and you only pay for calls that work.