loopling.ai

API reference

Generate and edit images

Create an image, follow its status and retrieve the finished result.

Generate an image

Send POST /v1/images/generations with a bearer API key and a JSON body. Nano Banana 2.1 supports text-to-image and editing with reference images. The response is asynchronous: HTTP 202 returns an img_… id, then poll its status.

curl https://loopling.ai/v1/images/generations \
  -H "Authorization: Bearer $LOOPLING_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: image-001" \
  -d '{"model":"nano-banana-2.1","prompt":"A quiet watercolor greenhouse, soft morning light","size":"1K","aspect_ratio":"1:1"}'
FieldMeaning
modelRequired: nano-banana-2.1.
promptRequired, up to 16,000 characters.
size1K (default), 2K, or 4K.
aspect_ratioDefault 1:1. Supported values are returned by GET /v1/models/nano-banana-2.1.
reference_imagesOptional array of up to 14 public HTTPS image URLs. PNG, JPEG or WebP; 7 MB per image and 24 MB total.

Each request generates one image. Unknown parameters are rejected before billing. Private-network reference URLs and unsafe redirects are blocked.

Read the result

Call GET /v1/images/generations/{id} with the same account's API key. HTTP 200 returns the task. Status moves from queued to running, then succeeded or failed. A successful response contains image.url, content_type, size_bytes, width, height, and expires_at. The request and final ink_charged and usd_payg_charged remain available in the request record.

GET /v1/images/generations/{id}/content returns HTTP 302, redirecting to a fresh signed download URL. An unfinished task answers 409; an expired image answers 410. Download within seven days. Signed URLs last at most fifteen minutes; read the generation again to renew one.

Billing and retries

Image generation uses Google directly. Usage is charged at the API rates in the model catalogue, rounded down to whole Ink per request. Input and thinking tokens contribute to the total. If an image arrives without complete usage, only the published image-output estimate is charged; billing_basis says image-output-estimate.

Admission reserves a conservative maximum covering the input context and output cap. The final charge never exceeds that hold; unused Ink is refunded. Failed deliveries refund the entire hold. Current rates and the hold are published by GET /v1/models/nano-banana-2.1 and on the model page.

Reuse the same Idempotency-Key for retries of an identical request. A changed request with the same key answers 409 idempotency_conflict. The server never sends an admitted image request to Google twice after a restart. Two image requests may run at once per account, subject to its shared generation, balance and daily limits.

Try Nano Banana 2.1 · Create an API key

Explore models

loopling.ai · grows with you, grows itself

hello@loopling.ai · for agents · community · pricing · API · privacy · terms