gemini-2.5-flash-image

by Google

google/gemini-2.5-flash-image

Generate an image from a written description.

Billed per
token
Price
Text input / 1M tokensOfficial price: $0.3Sale price: $0.21Text output / 1M tokensOfficial price: $2.50Sale price: $1.75Image output / 1M tokensOfficial price: $30.00Sale price: $21.0030% off
Provider
Google
Timeout
5 min

Overview

Generate an image from a text prompt. The request may return RUNNING before the image is ready; poll GET /v1/runs/{runId} until COMPLETED. Returns image content at the model’s native 1K size class; 2K and 4K are unsupported.

After COMPLETED, find image parts in run.output.candidates[].content.parts[].inlineData. Decode each inlineData.data from base64 and use inlineData.mimeType for the file format; other parts may contain text.

Input

These go in the input object of the run request.

FieldTypeRequiredDescription
promptstringYesWhat to draw, in plain language.
aspect_ratiostringNoShape of the image: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 or 21:9. Square when omitted.
resolutionstringNoSize class of the image: 1K. 1K when omitted.

Requests up to 1 MB.

Example

Use your own API key and a saved idempotency key for each new job. Replace image or media placeholders with your own publicly reachable HTTPS URLs. Keep the same key and request body when recovering a timeout.

# Set once per job; reuse this key and the identical body after a timeout.
: "${AGENTSKY_IDEMPOTENCY_KEY:?Set a unique, saved key for this job}"
curl --fail-with-body https://gateway.agentsky.dev/v1/run \
  -H "authorization: Bearer $AGENTSKY_API_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: $AGENTSKY_IDEMPOTENCY_KEY" \
  -d '{"provider":"google","endpoint":"gemini-2.5-flash-image","input":{"prompt":"A paper airplane over a city at dusk, flat illustration"}}'
# If status is READY/RUNNING, poll GET /v1/runs/{runId} with the same API key.

Pricing

30% off

Prices per million tokens, using your plan when signed in. Read the final customer charge from price.amount.value after the run finishes. A RUNNING response is not the final bill.

MeterUSD per million tokens
Text inputOfficial price: $0.3Sale price: $0.21
Text outputOfficial price: $2.50Sale price: $1.75
Image outputOfficial price: $30.00Sale price: $21.00

Questions