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. Move the request to a backend that sets base_url to https://relaydance.com/v1 and sends Authorization: Bearer YOUR_API_KEY. Server-side calls also keep your key private and let you poll GET /v1/video/generations/{task_id} or receive a webhook, which browser code cannot do reliably.
Why the browser triggers a CORS error
The browser blocks the call because cross-origin requests to the API from client JavaScript are not the supported integration path. RelayDance follows the OpenAI protocol: according to the official relaydance.com/docs docs, 「Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK」. That SDK is intended for server runtimes. Calling from the browser also exposes your key, which must be sent as Authorization: Bearer YOUR_API_KEY and created at the console. A backend removes the cross-origin restriction, protects the credential, and gives you a stable place to poll task status or accept a webhook POST, none of which fit a client-only design.
The correct server-side pattern
The fix is to submit and poll from your server, then return only the finished video URL to the browser. Use these steps:
- Set
base_urltohttps://relaydance.com/v1and sendAuthorization: Bearer YOUR_API_KEY. - POST
/v1/video/generationswithmodel,prompt,seconds, andmetadata(ratio, resolution, generate_audio, callback_url, content[]). - Poll
GET /v1/video/generations/{task_id}until status issucceededorfailed. - Or set
metadata.callback_urlso the final state is POSTed to your server (webhook mode). - Read the video url from the result and pass it to the browser.
Reference media go in metadata.content[] and are cited in the prompt as @image1 to @imageN: up to 9 reference images, 3 reference videos, and 3 audio tracks per request, with clips up to 15 seconds.
Billing during retries and errors
You do not pay for the failed attempts that a CORS-blocked or misconfigured client might generate on the server side. According to the official relaydance.com docs, 「Failed or errored requests are never billed」. Billing is pay-as-you-go per generated video. Current per-second rates at relaydance.com/models include Seedance 2.0 720p at about $0.190 / second and Seedance 2.0 1080p at about $0.470 / second, with Seedance Fast at about $0.152 / second and native 4K at about $4.90 per 5-second clip. Because errors are not charged, you can move your integration to the server and re-run failed calls without cost concern.
Client-only versus server-side integration
Server-side integration resolves the CORS error and adds capabilities the browser lacks, as shown below.
| Aspect | Browser-only | Server-side |
|---|---|---|
| CORS | Blocked | No restriction |
| API key | Exposed | Kept private |
| Polling task status | Not reliable | Supported via GET |
| Webhook callback_url | No server to receive | Supported |
| Failed request cost | Not billed | Not billed |
See relaydance.com/docs for the request and polling reference. For image tasks, gpt-image-2 bills input only (output is free), image-to-image starts from about CNY 0.035, and 4K and 1K output cost the same.
FAQ
Can I call RelayDance directly from browser JavaScript? No. The API is OpenAI-compatible and intended for server use; call it from a backend with base_url set to https://relaydance.com/v1.
Will my blocked or failed requests be charged? No. 「Failed or errored requests are never billed」 (relaydance.com), so retries after fixing CORS do not add cost.
How do I get the finished video from the server? Poll GET /v1/video/generations/{task_id} until status is succeeded, or set metadata.callback_url for a webhook POST, then read the video url.
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.