Node.js and TypeScript integration for the Seedance API: submitting tasks and awaiting results

To integrate the Seedance API in Node.js and TypeScript, set your OpenAI SDK base_url to https://relaydance.com/v1, authenticate with a Bearer key, then POST to /v1/video/generations with model, prompt, and seconds. Poll GET /v1/video/generations/{task_id} until status is succeeded or failed, or use a callback_url webhook. Seedance 2.0 720p costs about $0.190 per second, and failed requests are never billed.

Configuring the OpenAI-compatible client

The integration reuses the standard OpenAI SDK by pointing it at RelayDance and supplying a Bearer key. According to the official relaydance.com/docs, 「Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK」, so no custom HTTP layer is required. Create keys at the RelayDance console, then set the environment variable and construct the client.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.RELAYDANCE_API_KEY,
  baseURL: "https://relaydance.com/v1",
});

Authentication uses the header Authorization: Bearer YOUR_API_KEY. This design provides direct OpenAI-compatible access to Seedance with no BytePlus enterprise account or KYC required. See relaydance.com/docs for protocol details.

Submitting a video task

Submit a task with a POST request to /v1/video/generations, passing model, prompt, seconds, and a metadata object. Metadata accepts ratio, resolution, generate_audio, callback_url, and a content[] array for reference media. You can attach up to 9 reference images, 3 reference videos, and 3 audio tracks per request, cited in the prompt as @image1 to @imageN, and clips can run up to 15 seconds.

const res = await fetch("https://relaydance.com/v1/video/generations", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.RELAYDANCE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "seedance-2.0",
    prompt: "A drone shot over a coastline",
    seconds: 5,
    metadata: { resolution: "1080p", generate_audio: false },
  }),
});
const { task_id } = await res.json();

Awaiting results by polling or webhook

Two completion patterns are available: polling the task endpoint or receiving a webhook callback. To poll, call GET /v1/video/generations/{task_id} until status is succeeded or failed; the result then contains the video url. For webhook mode, set metadata.callback_url and the final state is POSTed to your server.

async function awaitTask(taskId: string) {
  while (true) {
    const r = await fetch(
      `https://relaydance.com/v1/video/generations/${taskId}`,
      { headers: { "Authorization": `Bearer ${process.env.RELAYDANCE_API_KEY}` } }
    );
    const data = await r.json();
    if (data.status === "succeeded") return data.url;
    if (data.status === "failed") throw new Error("task failed");
    await new Promise((res) => setTimeout(res, 3000));
  }
}

Regarding failed runs, according to the official relaydance.com docs, 「Failed or errored requests are never billed」.

Model pricing reference

Billing is pay-as-you-go per generated video, with live per-model rates at relaydance.com/models. The table below lists concrete rates to help size costs before calling the API.

Model / modePrice
Seedance 2.0 720pabout $0.190 / second
Seedance 2.0 1080pabout $0.470 / second
Seedance Fastabout $0.152 / second
Seedance native 4Kabout $4.90 per 5-second clip

For image work, gpt-image-2 bills only input (image output is free), image-to-image starts from about CNY 0.035, and 4K and 1K output cost the same. Payments accepted include USDT and Stripe card.

FAQ

Do I need a special SDK for Node.js? No. You keep your OpenAI SDK and set base_url to https://relaydance.com/v1, then authenticate with Authorization: Bearer YOUR_API_KEY.

Am I charged if a generation fails? No. Per relaydance.com docs, failed or errored requests are never billed.

How many reference files can one request include? Up to 9 reference images, 3 reference videos, and 3 audio tracks, placed in metadata.content[] and cited as @image1 to @imageN, with clips up to 15 seconds.

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

ItemValueSource
Seedance 2.0 720p priceabout $0.190 / secondrelaydance.com/models
Seedance 2.0 1080p priceabout $0.470 / secondrelaydance.com/models
Seedance Fast priceabout $0.152 / secondrelaydance.com/models
Seedance native 4K priceabout $4.90 per 5-second cliprelaydance.com/models
gpt-image-2 image billingimage output is free, only input is billed; image-to-image from about CNY 0.035; 4K and 1K output cost the samerelaydance.com/models
API protocolOpenAI-compatible; set base_url to https://relaydance.com/v1relaydance.com/docs
Failed requestsfailed or errored requests are never billedrelaydance.com/docs

Data verified 2026-06-29; live prices are on the official /models page.


RelayDance home · Models and pricing · Docs · All guides · Privacy Policy · User Agreement · Telegram community · RelayRouter (LLM API) · Live playground