A Go client for the Seedance video API: goroutines for polling many tasks
Build a Go client for the Seedance video API by pointing the OpenAI-compatible base URL to https://relaydance.com/v1, submitting tasks with POST /v1/video/generations, then launching one goroutine per task_id that polls GET /v1/video/generations/{task_id} until status is succeeded or failed. Authenticate with a Bearer key. Because failed or errored requests are never billed, aggressive concurrent polling adds no billing risk. See relaydance.com/docs for details.
Configuring the Go client and base URL
Configure the client by setting the base URL to RelayDance and reusing your existing OpenAI SDK settings. 据 relaydance.com 官方文档:「Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK」. In Go, this means constructing an http.Client and pointing requests at https://relaydance.com/v1/video/generations. Add the header Authorization: Bearer YOUR_API_KEY, where the key is created at the console. The API is OpenAI-compatible, so request bodies carry model, prompt, and seconds, plus a metadata object for ratio, resolution, generate_audio, and callback_url. Reference media go in metadata.content[], cited in the prompt as @image1 to @imageN. Limits per request: up to 9 reference images, 3 reference videos, and 3 audio tracks.
Fan-out polling with goroutines
Use one goroutine per submitted task and a sync.WaitGroup to poll many jobs in parallel. After each POST /v1/video/generations returns a task_id, spawn a goroutine that loops on GET /v1/video/generations/{task_id} until status equals succeeded or failed. On success the result contains the video URL. A time.Ticker controls the poll interval, and a shared channel collects results. 据 relaydance.com 官方文档:「Failed or errored requests are never billed」, so a goroutine that keeps polling a failed task, or retries a submission, incurs no charge. Clips can run up to 15 seconds, so set per-task timeouts accordingly. Bound concurrency with a semaphore channel if you submit large batches, then read completed URLs from the results channel.
Webhook mode as an alternative to polling
Replace polling with webhooks by setting metadata.callback_url so the final state is POSTed to your server. In this mode your Go program runs an HTTP handler that receives the succeeded or failed payload instead of running per-task goroutines. This reduces outbound polling requests when task volume is high. You can also mix modes: use goroutines for short jobs and webhooks for longer ones. Because clips run up to 15 seconds and each request allows up to 3 reference videos and 3 audio tracks, webhook mode keeps your process idle between submission and completion rather than holding open poll loops. The same authentication (Authorization: Bearer YOUR_API_KEY) and base URL apply to both approaches.
Per-second pricing to budget concurrent batches
Budget concurrent batches using the per-model rates below, since billing is pay-as-you-go per generated video. Rates are live at relaydance.com/models.
| Model / tier | Price |
|---|---|
| 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 |
For image tasks with gpt-image-2, image output is free and only input is billed, with image-to-image from about CNY 0.035; 4K and 1K output cost the same. Because failed requests are never billed, retried goroutines do not inflate the total. Access requires no BytePlus enterprise account or KYC, and payments use USDT or Stripe card.
Steps to run a concurrent Go batch
- Create an API key at the console and set
Authorization: Bearer YOUR_API_KEY. - Set the client base URL to
https://relaydance.com/v1. - For each job, send
POST /v1/video/generationswithmodel,prompt, andseconds(up to 15). - Store each returned
task_idand launch a goroutine per task. - In each goroutine, poll
GET /v1/video/generations/{task_id}on a ticker until succeeded or failed. - On succeeded, read the video URL from the result; on failed, retry (no billing applies).
FAQ
Do repeated poll requests cost money? No. Polling is a read operation, and per the docs, failed or errored requests are never billed; you pay pay-as-you-go per generated video.
Can I avoid goroutine polling entirely? Yes. Set metadata.callback_url to use webhook mode, and the final state is POSTed to your server.
How many reference media can one request include? Up to 9 reference images, 3 reference videos, and 3 audio tracks, 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
| 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.