Skip to content
Genflo

Create a generation task

Create an image or video generation task with one POST request to the Genflo API: pick a model and send its input with your API key.

Updated View as Markdown

Send a POST request to https://api.genflo.io/api/saas with your API key, a model ID and that model’s input. Each model page in the sidebar lists the model’s exact input schema with a complete example containing every published field.

Request

The body has two fields. model is the model ID shown on each model page. input holds the fields that model accepts; optional fields can be left out. The example below shows the complete Seedance 2.0 Fast request shape.

curl -X POST 'https://api.genflo.io/api/saas' \
  -H 'Content-Type: application/json' \
  -H 'x-apikey: sk-your-api-key' \
  -d '{
    "model": "seedance-2.0-fast",
    "input": {
      "prompt": "The camera slowly moves forward",
      "negative_prompt": "blur, distortion, artifacts",
      "enhance_prompt": true,
      "images": ["https://cdn.example.com/reference-image.jpg"],
      "videos": ["https://cdn.example.com/reference-video.mp4"],
      "audios": ["https://cdn.example.com/reference-audio.mp3"],
      "first_frame": "https://cdn.example.com/first-frame.jpg",
      "duration": 4,
      "resolution": "480P",
      "aspect_ratio": "21:9",
      "generate_audio": true,
      "seed": 123456789
    }
  }'

Response

The API returns HTTP 202 with the new task. Its id is the task ID you poll with Retrieve task status, and usage.credits is the amount charged.

{
  "object": "generation.task",
  "id": 12345,
  "model": "seedance-2.0-fast",
  "type": "video",
  "status": "pending",
  "usage": { "credits": "168.00" },
  "output": null,
  "error": null,
  "created_at": "2026-08-10T12:00:00Z",
  "completed_at": null
}

Create a task and wait for the output

These examples create an 8-second Seedance 2.0 Fast video, poll the task every 5 seconds until it finishes, and print the output URL. Set the GENFLO_API_KEY environment variable to your API key first.

Install the requests package with pip install requests.

import os
import time

import requests

API_URL = "https://api.genflo.io/api/saas"
HEADERS = {"x-apikey": os.environ["GENFLO_API_KEY"]}
FINAL_STATUSES = {"success", "failed", "rejected"}

response = requests.post(
    API_URL,
    headers=HEADERS,
    json={
        "model": "seedance-2.0-fast",
        "input": {
            "prompt": "The camera slowly moves forward",
            "duration": 8,
            "resolution": "720P",
            "aspect_ratio": "16:9",
        },
    },
    timeout=30,
)
response.raise_for_status()
task = response.json()

while task["status"] not in FINAL_STATUSES:
    time.sleep(5)
    response = requests.get(
        API_URL, headers=HEADERS, params={"task_id": task["id"]}, timeout=30
    )
    response.raise_for_status()
    task = response.json()

if task["status"] == "success":
    print(task["output"]["url"])
else:
    print(task["status"], task["error"]["message"])

Requires Node.js 18 or later. Save the code as create-task.mjs and run node create-task.mjs.

const API_URL = "https://api.genflo.io/api/saas";
const headers = { "x-apikey": process.env.GENFLO_API_KEY };
const FINAL_STATUSES = new Set(["success", "failed", "rejected"]);

async function readTask(response) {
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${await response.text()}`);
  }
  return response.json();
}

let task = await readTask(
  await fetch(API_URL, {
    method: "POST",
    headers: { ...headers, "Content-Type": "application/json" },
    body: JSON.stringify({
      model: "seedance-2.0-fast",
      input: {
        prompt: "The camera slowly moves forward",
        duration: 8,
        resolution: "720P",
        aspect_ratio: "16:9",
      },
    }),
  }),
);

while (!FINAL_STATUSES.has(task.status)) {
  await new Promise((resolve) => setTimeout(resolve, 5000));
  task = await readTask(await fetch(`${API_URL}?task_id=${task.id}`, { headers }));
}

console.log(task.status === "success" ? task.output.url : `${task.status}: ${task.error.message}`);
Navigation

Type to search…

↑↓ navigate↵ selectEsc close