Generate Seedance videos with the openai Python package: base_url setup and task polling

To generate Seedance videos with the openai Python package, create an OpenAI client with base_url set to https://relaydance.com/v1 and your RelayDance API key. Submit a task with POST /v1/video/generations (model, prompt, seconds, metadata), then poll GET /v1/video/generations/{task_id} until status is succeeded or failed. A succeeded result contains the video url. You can also set metadata.callback_url to receive the final state by webhook.

How do you configure the openai client for RelayDance?

You configure the client by passing base_url="https://relaydance.com/v1" and your RelayDance API key to the standard OpenAI constructor. According to the relaydance.com docs, “Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK”, so no extra library is needed. The SDK sends the key as Authorization: Bearer YOUR_API_KEY on every request. You can create keys at https://relaydance.com/console. Access to Seedance through this endpoint does not require a BytePlus enterprise account or KYC, and payments are accepted in USDT or by Stripe card.

from openai import OpenAI import httpx client = OpenAI(api_key="YOUR_API_KEY", base_url="https://relaydance.com/v1")

How do you submit a Seedance video task?

You submit a video task by sending POST /v1/video/generations with model, prompt, seconds and a metadata object. The openai package has no dedicated method for this route, so the SDK's generic client.post() helper sends the request through the same authenticated client. The metadata object accepts ratio, resolution, generate_audio, callback_url and content[] reference media. Reference media 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 run up to 15 seconds.

resp = client.post("/video/generations", cast_to=httpx.Response, body={ "model": "doubao-seedance-2-5-1080p", "prompt": "A paper boat drifting down a rainy street", "seconds": 5, "metadata": {"generate_audio": True}, }) task = resp.json() # read the task id; see the docs for the exact field name

How do you poll the task or use a webhook?

You poll GET /v1/video/generations/{task_id} until status is succeeded or failed, then read the video url from the result. A short sleep between checks keeps the request volume low. If you prefer not to poll, set metadata.callback_url when submitting, and the final state is POSTed to your server. Failed tasks carry no charge: according to relaydance.com, “Failed or errored requests are never billed”, so a retry after a failed status costs nothing for the failed attempt.

import time while True: r = client.get(f"/video/generations/{task_id}", cast_to=httpx.Response).json() if r["status"] in ("succeeded", "failed"): break time.sleep(5)

How much does Seedance video generation cost?

Billing is pay-as-you-go per generated video, with rates listed at relaydance.com/models. The table below lists the published approximate rates. Seedance 2.5 1080p (model doubao-seedance-2-5-1080p) was added on 2026-10-10. For images, gpt-image-2 runs through POST /v1/images/generations (the SDK's client.images.generate()): image output is free and input is billed, image-to-image starts from about CNY 0.035, and 4K and 1K output cost the same.

Model / tierApproximate price
Seedance Fast$0.152 / second
Seedance 2.0 720p$0.190 / second
Seedance 2.0 1080p$0.470 / second
Seedance 2.5 1080p$0.711 / second
Seedance native 4K$4.90 per 5-second clip

FAQ

The answers below cover common setup questions about using the openai Python package with RelayDance.

Do I need a separate SDK for Seedance? No. The standard openai package works once base_url is set to https://relaydance.com/v1; video routes are called with client.post() and client.get().

Am I charged when a generation fails? No. Failed or errored requests are not billed, so a task ending in failed status incurs no charge.

How long can a generated clip be? Clips can be up to 15 seconds, set through the seconds field. A 5-second 1080p clip on Seedance 2.0 costs about $2.35 at $0.470 per second. Check relaydance.com/models for live rates.

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 2.5 1080p priceabout $0.711 / second, added 2026-10-10, model doubao-seedance-2-5-1080prelaydance.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