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 / tier | Rate |
|---|---|
| Seedance 2.0 720p | about $0.190 / second |
| Seedance 2.0 1080p | about $0.470 / second |
| Seedance Fast | about $0.152 / second |
| Seedance native 4K | about $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.
- Create an API key at https://relaydance.com/console.
- Set
base_urltohttps://relaydance.com/v1in your OpenAI SDK client. - Build the Streamlit form: prompt, seconds, resolution, optional reference media.
- Submit with
POST /v1/video/generationsand store the task_id. - Poll
GET /v1/video/generations/{task_id}or use acallback_urlwebhook. - 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
| 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 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.