Skip to content
FlowAPI

Documentation

llms.txt

Image generation API

POST /v1/generations creates 1 to 4 images per request with any image model in the catalog; the price is the flat per-image price of the chosen spec times n, for example $0.027 per Nano Banana Pro image at 1K/2K.

Request

Field Type Notes
model string A model id from /models, e.g. google/nano-banana-pro
input.type string text or image: text-to-image, or image-to-image with references
input.prompt string What to generate
input.references array For image mode: [{ "role": "reference_image", "url": "https://…" }] or { "file_id": "file_…" } from input files
parameters.resolution string Selects the price row, e.g. 1K, 2K, 4K
parameters.n integer 1–4 images, default 1
webhook_url string Optional https URL, stored for webhooks

cURL

bash
curl https://useflowapi.com/v1/generations \
  -H "Authorization: Bearer $FLOWAPI_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1234-image" \
  -d '{"model":"google/nano-banana-pro","input":{"type":"text","prompt":"A red bicycle leaning on a brick wall"},"parameters":{"resolution":"1K","n":1}}'

TypeScript (fetch, Node 18+)

ts
const res = await fetch('https://useflowapi.com/v1/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.FLOWAPI_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'order-1234-image',
  },
  body: JSON.stringify({
    "model": "google/nano-banana-pro",
    "input": {
      "type": "text",
      "prompt": "A red bicycle leaning on a brick wall"
    },
    "parameters": {
      "resolution": "1K",
      "n": 1
    }
  }),
});
const job = await res.json();
console.log(job.id, job.status, job.price.amount);

Python (requests)

python
import os, requests

res = requests.post(
    "https://useflowapi.com/v1/generations",
    headers={
        "Authorization": f"Bearer {os.environ['FLOWAPI_KEY']}",
        "Idempotency-Key": "order-1234-image",
    },
    json={
      "model": "google/nano-banana-pro",
      "input": {
        "type": "text",
        "prompt": "A red bicycle leaning on a brick wall"
      },
      "parameters": {
        "resolution": "1K",
        "n": 1
      }
    },
)
job = res.json()
print(job["id"], job["status"], job["price"]["amount"])

Image-to-image

json
{
  "model": "google/nano-banana-pro",
  "input": {
    "type": "image",
    "prompt": "Make it a watercolor painting",
    "references": [{ "role": "reference_image", "file_id": "file_…" }]
  },
  "parameters": { "resolution": "1K" }
}

Check the price first

POST /v1/quotes takes the same body and returns the exact price without creating a job or charging. Every image spec and price is listed on /models and /pricing.

FAQ

How many images can one request make?
One request makes 1 to 4 images (parameters.n), and the price is the per-image price times n.
Can I edit an existing image?
Yes. Set input.type to image and pass the source picture in input.references with role reference_image.
Is a failed image job refunded?
Yes. A failed or cancelled job is refunded in full and shows "refunded": true.