Tasks

Create, fetch and list tasks. Statuses, the task object and input rules.

A task is one generation request. Creating it charges your balance and queues the work; the result arrives later.

Create a task

POST /api/v1/tasks

{
  "model": "nano-banana-2.1",
  "input": { "prompt": "a lighthouse at dusk", "resolution": "2K" },
  "callback_url": "https://example.com/hook"
}
FieldRequiredNotes
modelyesA model id from GET /models.
inputyesAn object that matches the model's input_schema.
callback_urlnoA public https URL we post the result to. See Webhooks.

Send an Idempotency-Key header so a retry cannot create a second task. See Errors and idempotency.

The response is 201 with the task object, and status is waiting. 201 means accepted and charged, not finished.

We check your key, your unfinished-task limit and the input against the model's schema before anything is charged. A request that fails any check costs nothing.

The task object

{
  "id": "task_...",
  "model": "nano-banana-2.1",
  "status": "success",
  "input": { "prompt": "a lighthouse at dusk", "resolution": "2K" },
  "output": { "urls": ["https://cdn.nsfwapi.io/results/..."], "expires_at": "2026-12-15T00:00:00Z" },
  "error": null,
  "cost": "0.038",
  "refunded": false,
  "created_at": "2026-12-01T09:14:04Z",
  "completed_at": "2026-12-01T09:14:32Z"
}
  • cost is the price fixed when the task was created.
  • output has a value only when status is success. error has a value only when it is fail: { "code", "message" }.
  • On fail, the full price is refunded to your balance and refunded is true. cost still shows the original price.
  • Times are ISO 8601 in UTC. Clients must ignore fields they do not know; we may add fields without a version change.

Statuses

waiting → queuing → generating → success or fail.

StatusMeaning
waitingAccepted and charged, not yet sent to a model.
queuingSent to a model, waiting for it to start.
generatingThe model is working.
successDone. Files are in output.urls. Final.
failIt did not complete. Refunded. Final.

success and fail are final: a task never changes after that. Poll every two seconds or so, or use a webhook.

Result files

Files are served from cdn.nsfwapi.io and kept for at least 14 days. output.expires_at tells you when they may disappear. Download anything you need to keep.

Get one task

GET /api/v1/tasks/{id} returns the task object. You can only read your own tasks; anyone else's id answers 404.

List tasks

GET /api/v1/tasks

QueryNotes
limit1 to 100. Default 20.
cursorThe next_cursor from the previous page.
statusOnly tasks in this status.
modelOnly tasks for this model.
{ "data": [ { "id": "task_...", "status": "success" } ], "next_cursor": "..." }

next_cursor is null on the last page. Newest tasks come first. Treat the cursor as an opaque string.

Models

GET /api/v1/models returns { "data": [ ... ] } with the models you can use. GET /api/v1/models/{id} returns a single model object, shaped like this:

{
  "id": "nano-banana-2.1",
  "type": "image",
  "name": "Nano Banana 2.1",
  "description": "...",
  "input_schema": { "type": "object", "required": ["prompt"], "properties": { } },
  "pricing": { "type": "per_task", "price": "0.025", "by": { "field": "resolution", "prices": { "1K": "0.025", "2K": "0.038", "4K": "0.057" } } }
}
  • input_schema is a standard JSON Schema. Validate your input against it before you send it.
  • pricing is the price rule. per_task charges once, per_image charges per image, per_second charges per second of video. When by is present, the price depends on that input field; a value not listed uses price.

Input rules

  • Images and videos you pass in must be public https URLs. There is no upload endpoint. Plain http, URLs with a username or password, IP addresses, and private hostnames such as localhost or .internal are rejected.
  • The request body can be up to 128 KB, and input up to 64 KB.
  • Each account can have 20 unfinished tasks at once by default. Beyond that you get 429 rate_limited with a Retry-After header. We do not queue silently.