跳到正文
FlowAPI

文档

llms.txt

Quickstart: your first generation

Your first FlowAPI request takes 3 steps: create a key, send POST /v1/generations, and read the job. A flow_sk_test_ key returns a fixed sample result at $0, so you can wire up your code before adding funds.

1. Create an API key

Sign in and open the console. Create a test key (flow_sk_test_…) to build your integration, and a live key (flow_sk_live_…) when you are ready to generate real images and videos. Store it in an environment variable:

bash
export FLOWAPI_KEY="flow_sk_test_…"

2. Submit a generation

Every request names a model id, an input (prompt plus optional reference files) and parameters. The Idempotency-Key header is required so a retried request never creates a second job.

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"])

The response is 202 Accepted with a job object. Live keys are charged the quoted price at this moment: $0.027 for 1 Nano Banana Pro image (1K/2K).

3. Read the job

bash
curl https://useflowapi.com/v1/jobs/JOB_ID -H "Authorization: Bearer $FLOWAPI_KEY"

Poll until status is succeeded, failed or cancelled. A succeeded job lists its files under result.files:

json
{
  "id": "job_…",
  "object": "job",
  "status": "succeeded",
  "model": "google/nano-banana-pro",
  "mode": "live",
  "price": { "amount": "0.027", "currency": "USD" },
  "refunded": false,
  "created_at": 1764460800,
  "completed_at": 1764460812,
  "urls": { "get": "/v1/jobs/job_…", "cancel": "/v1/jobs/job_…/cancel" },
  "result": {
    "files": [
      {
        "url": "https://…",
        "media_type": "image/png",
        "width": 1024,
        "height": 1024,
        "duration": null,
        "expires_at": 1767052812
      }
    ]
  },
  "error": null
}

Result URLs stay valid for 30 days (expires_at). Download anything you need to keep.

Next steps

常见问题

Do test keys cost money?
No. flow_sk_test_ keys are never charged and never call a model; every job returns the same sample file with status succeeded.
What is the FlowAPI API base URL?
The base URL is https://useflowapi.com/v1, and every endpoint takes the API key in an Authorization: Bearer header.
Do I need an SDK?
No. The API is plain JSON over HTTPS, so fetch, requests, cURL or any HTTP client works.