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:

  1. Create an API key at https://relaydance.com/console and store it as a server environment variable.
  2. Set base_url to https://relaydance.com/v1 in your OpenAI-compatible SDK on the server.
  3. POST to /v1/video/generations with model, prompt, and seconds.
  4. Poll GET /v1/video/generations/{task_id} until status is succeeded or failed, or set metadata.callback_url for webhook delivery.
  5. 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 / tierRate
Seedance Fastabout $0.152 / second
Seedance 2.0 720pabout $0.190 / second
Seedance 2.0 1080pabout $0.470 / second
Seedance native 4Kabout $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

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