Skip to content

Latest commit

 

History

History
94 lines (71 loc) · 1.93 KB

File metadata and controls

94 lines (71 loc) · 1.93 KB

Seedance 2.0 API — Queue & Webhooks

Seedance 2.0 generations can take tens of seconds to a few minutes. For production use, prefer the queue API with either polling or a webhook instead of a long-lived HTTP connection.

1. Submit a job

Python

import fal_client

handle = fal_client.submit(
    "bytedance/seedance-2.0/fast/text-to-video",
    arguments={"prompt": "..."},
    webhook_url="https://your.app/webhooks/seedance",  # optional
)
print(handle.request_id)

JavaScript

import { fal } from "@fal-ai/client";

const { request_id } = await fal.queue.submit(
  "bytedance/seedance-2.0/fast/text-to-video",
  {
    input: { prompt: "..." },
    webhookUrl: "https://your.app/webhooks/seedance", // optional
  }
);

2. Check status

Python

status = fal_client.status(
    "bytedance/seedance-2.0/fast/text-to-video",
    request_id,
    with_logs=True,
)

JavaScript

const status = await fal.queue.status(
  "bytedance/seedance-2.0/fast/text-to-video",
  { requestId: request_id, logs: true }
);

Possible statuses: IN_QUEUE, IN_PROGRESS, COMPLETED, FAILED.

3. Fetch the result

Python

result = fal_client.result(
    "bytedance/seedance-2.0/fast/text-to-video",
    request_id,
)
print(result["video"]["url"])

JavaScript

const result = await fal.queue.result(
  "bytedance/seedance-2.0/fast/text-to-video",
  { requestId: request_id }
);
console.log(result.data.video.url);

4. Webhooks

If you supplied webhook_url on submit, fal.ai will POST the final payload to it when the job finishes — the body matches the normal result schema:

{
  "request_id": "764cabcf-b745-4b3e-ae38-1200304cf45b",
  "status": "COMPLETED",
  "payload": {
    "video": { "url": "https://.../output.mp4" },
    "seed": 42
  }
}

Verify the request signature following fal.ai's webhook guide.