Build an internal video tool with Streamlit: a simple front end for the Seedance API

To build an internal video tool with Streamlit, wrap the RelayDance Seedance API in a Python front end: point your OpenAI SDK at https://relaydance.com/v1, POST prompts to /v1/video/generations, then poll /v1/video/generations/{task_id} until the status is succeeded. Streamlit renders inputs (prompt, seconds, resolution) and displays the returned video url. Seedance 2.0 720p costs about $0.190 per second, and failed requests are never billed.

Connect Streamlit to the RelayDance API

Connecting Streamlit to RelayDance requires only a base URL change and an API key, because the endpoint is OpenAI-compatible. According to the official relaydance.com/docs, "Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK." Create a key at the console, then store it as Authorization: Bearer YOUR_API_KEY. In your Streamlit app, load the key from an environment variable, initialize the client with the RelayDance base URL, and expose a text input for the prompt. Submit video tasks with POST /v1/video/generations, passing model, prompt, and seconds. See https://relaydance.com/docs for the request schema and metadata fields (ratio, resolution, generate_audio, callback_url).

Handle task submission and polling

Handle generation asynchronously: submit the task, capture the returned task_id, then poll until the job finishes. After POST /v1/video/generations, call GET /v1/video/generations/{task_id} on an interval until the status is succeeded or failed; on success the result contains the video url, which Streamlit displays with st.video(). Alternatively, set metadata.callback_url for webhook mode, where the final state is POSTed to your server. Reference media go in metadata.content[] and are cited in the prompt as @image1 to @imageN. A single request supports up to 9 reference images, 3 reference videos, and 3 audio tracks, with clips up to 15 seconds.

Add resolution and cost controls

Add resolution controls so internal users can pick a tier and see the per-second cost before submitting. Pull live rates from https://relaydance.com/models and surface them in the Streamlit sidebar. According to the official relaydance.com docs, "Failed or errored requests are never billed," so retries during testing carry no charge for errored jobs. Present the tiers in a select box mapped to the table below, and multiply the per-second rate by the chosen seconds to estimate cost.

Model / tierRate
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

Deployment steps for the internal tool

Deploy the tool in a few ordered steps so a team can run it on an internal host. Billing is pay-as-you-go per generated video, with USDT and Stripe card payments.

  1. Create an API key at https://relaydance.com/console.
  2. Set base_url to https://relaydance.com/v1 in your OpenAI SDK client.
  3. Build the Streamlit form: prompt, seconds, resolution, optional reference media.
  4. Submit with POST /v1/video/generations and store the task_id.
  5. Poll GET /v1/video/generations/{task_id} or use a callback_url webhook.
  6. Render the returned video url with st.video().

FAQ

Do I need a BytePlus enterprise account to use Seedance? No. RelayDance provides direct OpenAI-compatible access to Seedance with no BytePlus enterprise account or KYC required.

Am I charged for failed generations during testing? No. Failed or errored requests are never billed, per relaydance.com.

How do I add reference images in Streamlit? Place them in metadata.content[] and cite them in the prompt as @image1 to @imageN; a request supports up to 9 reference images.

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