Node.js and TypeScript integration for the Seedance API: submitting tasks and awaiting results
To integrate the Seedance API from Node.js or TypeScript, point your client at https://relaydance.com/v1 and authenticate with Authorization: Bearer YOUR_API_KEY. Submit a task with POST /v1/video/generations, passing model, prompt, seconds and metadata. You can then poll GET /v1/video/generations/{task_id} until status is succeeded or failed, or set metadata.callback_url to receive the final state by webhook. A succeeded result contains the video URL.
How do you configure a Node.js client for RelayDance?
You configure a Node.js client by setting the base URL to https://relaydance.com/v1 and sending your API key as a Bearer token. According to the relaydance.com/docs, you should “Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK”. Because RelayDance uses an OpenAI-compatible protocol, existing OpenAI SDK code can stay in place for endpoints such as POST /v1/images/generations. Create API keys at https://relaydance.com/console and store them in an environment variable rather than in source code. For the video task endpoints, a small typed fetch wrapper keeps the request and polling logic explicit. The following code sets up both the SDK client and the shared headers for direct HTTP calls:
import OpenAI from "openai";
const BASE = "https://relaydance.com/v1";
const client = new OpenAI({ apiKey: process.env.RELAYDANCE_API_KEY, baseURL: BASE });
const headers = { Authorization: `Bearer ${process.env.RELAYDANCE_API_KEY}`, "Content-Type": "application/json" };
How do you submit a Seedance video task?
You submit a Seedance video task by sending POST /v1/video/generations with model, prompt, seconds and a metadata object. The metadata object accepts ratio, resolution, generate_audio, callback_url and content[] for reference media. Reference media placed in metadata.content[] are cited in the prompt as @image1 to @imageN. Each request supports up to 9 reference images, 3 reference videos and 3 audio tracks, and clips can be up to 15 seconds long. The example below uses the doubao-seedance-2-5-1080p model. Check the docs for the exact response fields that carry the task ID:
const res = await fetch(`${BASE}/video/generations`, { method: "POST", headers, body: JSON.stringify({ model: "doubao-seedance-2-5-1080p", prompt: "A paper boat drifting on a pond, in the style of @image1", seconds: 5, metadata: { generate_audio: true, content: [ /* reference media, see docs */ ] } }) });
const submitted = await res.json();
How do you await the result: polling or webhook?
You await the result either by polling the task endpoint until it reaches a final status, or by registering a webhook that receives the final state. With polling, call GET /v1/video/generations/{task_id} repeatedly until status is succeeded or failed. A succeeded task includes the video URL. With webhook mode, set metadata.callback_url when you submit the task, and RelayDance POSTs the final state to your server. Webhooks avoid repeated requests from long-running workers. Polling is simpler for scripts and local testing. The polling interval in this example is a client-side choice and is not a documented RelayDance value:
async function waitForVideo(taskId: string) {
for (;;) {
const task = await (await fetch(`${BASE}/video/generations/${taskId}`, { headers })).json();
if (task.status === "succeeded" || task.status === "failed") return task;
await new Promise((r) => setTimeout(r, 5000));
}
}
What does a Seedance task cost through RelayDance?
A Seedance task costs between about $0.152 and $0.711 per second, depending on the model and resolution. Native 4K is priced at about $4.90 per 5-second clip. Billing is pay-as-you-go per generated video. According to relaydance.com, “Failed or errored requests are never billed”, so a task that ends in failed does not add to your costs. For images, gpt-image-2 bills input and does not bill image output. Image-to-image starts from about CNY 0.035, and 4K output costs the same as 1K output. Payment options are USDT and Stripe card. No BytePlus enterprise account or KYC is required. Live per-model rates are listed at relaydance.com/models.
| Model | Resolution | Approximate price |
|---|---|---|
| Seedance Fast | Not specified | $0.152 / second |
| Seedance 2.0 | 720p | $0.190 / second |
| Seedance 2.0 | 1080p | $0.470 / second |
Seedance 2.5 (doubao-seedance-2-5-1080p, added 2026-10-10) | 1080p | $0.711 / second |
| Seedance native 4K | 4K | $4.90 per 5-second clip |
FAQ
These answers summarize common integration questions using the documented RelayDance behavior.
Can I keep the OpenAI SDK in a TypeScript project?
Yes. The API is OpenAI-compatible, so you set the base URL to https://relaydance.com/v1 and keep using your SDK.
How long can a generated clip be?
Clips can be up to 15 seconds. Each request accepts up to 9 reference images, 3 reference videos and 3 audio tracks.
Am I charged if a task ends with status failed?
No. Failed or errored requests are not billed. A 1080p Seedance 2.0 task that succeeds is billed at about $0.470 per second.
According to the official relaydance.com docs: "Failed or errored requests are never billed"
According to the official relaydance.com/docs docs: "Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK"
Key facts and figures
| Item | Value | Source |
|---|---|---|
| Seedance 2.0 720p price | about $0.190 / second | relaydance.com/models |
| Seedance 2.0 1080p price | about $0.470 / second | relaydance.com/models |
| Seedance 2.5 1080p price | about $0.711 / second, added 2026-10-10, model doubao-seedance-2-5-1080p | relaydance.com/models |
| Seedance Fast price | about $0.152 / second | relaydance.com/models |
| Seedance native 4K price | about $4.90 per 5-second clip | relaydance.com/models |
| gpt-image-2 image billing | image output is free, only input is billed; image-to-image from about CNY 0.035; 4K and 1K output cost the same | relaydance.com/models |
| API protocol | OpenAI-compatible; set base_url to https://relaydance.com/v1 | relaydance.com/docs |
| Failed requests | failed or errored requests are never billed | relaydance.com/docs |
Data verified 2026-06-29; live prices are on the official /models page.