CORS error when calling RelayDance from the browser: why video generation belongs on the server
A CORS error appears because RelayDance is an OpenAI-compatible API meant to be called from your server, not directly from browser JavaScript. The RelayDance base URL (https://relaydance.com/v1) expects an Authorization: Bearer YOUR_API_KEY header, and exposing that key in client code is unsafe. Move the call server-side: your backend holds the key, submits the video task, and returns only the result URL to the browser.
Why the browser triggers a CORS error
The browser blocks the request because RelayDance is designed for server-to-server calls with a secret API key. When JavaScript running on a web page tries to POST to /v1/video/generations, the browser enforces the same-origin policy and rejects the cross-origin response unless the server explicitly allows it. More importantly, calling from the browser would require embedding Authorization: Bearer YOUR_API_KEY in client code, where any visitor can read it. According to the official relaydance.com/docs, 「Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK」. That SDK is intended to run in a backend environment, so the CORS block is a signal to relocate the call.
The correct server-side pattern
Fix the error by putting the entire request flow on your server and returning only the final URL to the client. Your backend authenticates with the API key, submits the task, polls for completion, and forwards the video URL to the browser. Follow these steps:
- Create an API key at
https://relaydance.com/consoleand store it as a server environment variable. - Set
base_urltohttps://relaydance.com/v1in your OpenAI-compatible SDK on the server. - POST to
/v1/video/generationswithmodel,prompt, andseconds. - Poll
GET /v1/video/generations/{task_id}untilstatusissucceededorfailed, or setmetadata.callback_urlfor webhook delivery. - Return the result URL to the browser as JSON.
Cost impact of retries and failed requests
Moving calls server-side also controls billing, because RelayDance charges per generated video on a pay-as-you-go basis. According to the official relaydance.com docs, 「Failed or errored requests are never billed」, so a CORS failure or a rejected request carries no charge. Live per-model rates are published at relaydance.com/models. For reference, Seedance 2.0 720p is about $0.190 per second, Seedance 2.0 1080p is about $0.470 per second, Seedance Fast is about $0.152 per second, and Seedance native 4K is about $4.90 per 5-second clip. Because failed requests are not billed, server-side retry logic can safely handle transient errors.
Per-second and per-clip rate comparison
Rates differ by model and resolution, so pick the tier that matches your output target. The table below lists current example rates from relaydance.com/models:
| Model / tier | Rate |
|---|---|
| Seedance Fast | about $0.152 / second |
| Seedance 2.0 720p | about $0.190 / second |
| Seedance 2.0 1080p | about $0.470 / second |
| Seedance native 4K | about $4.90 per 5-second clip |
For image workloads via /v1/images/generations, image output is free and only input is billed, image-to-image starts from about CNY 0.035, and 4K and 1K output cost the same. See relaydance.com/docs for request details.
FAQ
Can I call RelayDance directly from browser JavaScript? No. The API expects an Authorization: Bearer YOUR_API_KEY header, and exposing that key in client code is unsafe, so calls belong on your server.
Will a CORS-blocked or failed request be billed? No. Failed or errored requests are never billed; billing is pay-as-you-go per generated video.
How do I set up the SDK on the server? Set base_url to https://relaydance.com/v1, keep your OpenAI SDK, and create your key at https://relaydance.com/console.
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.