Using the Vercel AI SDK with an OpenAI compatible provider for Seedance video
You can use the Vercel AI SDK with RelayDance by registering it as an OpenAI-compatible provider, with baseURL set to https://relaydance.com/v1 and your RelayDance API key. The provider handles text and image calls. Seedance video runs as an asynchronous task: you send a POST to /v1/video/generations with the same key, then poll GET /v1/video/generations/{task_id} until the status is succeeded or failed.
How do you configure RelayDance as a provider in the Vercel AI SDK?
You configure RelayDance with the SDK's OpenAI-compatible provider factory and point it at the RelayDance base URL. According to the relaydance.com docs, you should “Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK”, and the same rule applies to the AI SDK's baseURL option. Authentication uses the header Authorization: Bearer YOUR_API_KEY, and you create keys at relaydance.com/console. A minimal setup looks like this:
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
const relaydance = createOpenAICompatible({ name: 'relaydance', baseURL: 'https://relaydance.com/v1', apiKey: process.env.RELAYDANCE_API_KEY });
Store the key in an environment variable on the server, and do not ship it to the browser. Full request details are in the RelayDance docs.
How do you submit a Seedance video generation task?
You submit a Seedance video task by sending a POST request to /v1/video/generations with model, prompt, seconds and an optional metadata object. The video endpoint is task based, so you call it with fetch on the server, reusing the same base URL and key as your AI SDK provider. The metadata object accepts ratio, resolution, generate_audio, callback_url and content[] for reference media. In the prompt, you refer to reference images as @image1 to @imageN. Each request supports up to 9 reference images, 3 reference videos and 3 audio tracks, and clips can be up to 15 seconds long.
const res = await fetch('https://relaydance.com/v1/video/generations', { method: 'POST', headers: { Authorization: `Bearer ${process.env.RELAYDANCE_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'doubao-seedance-2-5-1080p', prompt: 'A dancer in the rain, camera follows @image1', seconds: 5, metadata: { generate_audio: true } }) });
How do you retrieve the finished video?
You retrieve the finished video either by polling the task or by receiving a webhook. To poll, call GET /v1/video/generations/{task_id} at an interval until status is succeeded or failed. A succeeded result contains the video URL, which you can store or pass to your frontend. To use a webhook, set metadata.callback_url when you submit the task, and RelayDance POSTs the final state to your server. Webhooks suit serverless functions on Vercel, because a single request does not have to stay open while the clip renders. Retrying after a failure carries no charge for the failed attempt, since according to the relaydance.com docs, “Failed or errored requests are never billed”.
What does Seedance video cost through RelayDance?
Seedance video on RelayDance is billed pay-as-you-go per generated video, with rates ranging from about $0.152 per second to about $4.90 per 5-second 4K clip. The table below lists the rates published on relaydance.com/models. At these rates, a 10-second Seedance 2.0 clip at 1080p costs about $4.70. For images, gpt-image-2 does not charge for image output and bills the input, with image-to-image from about CNY 0.035. 4K and 1K output cost the same. Payment is by USDT or Stripe card, and you do not need a BytePlus enterprise account or KYC.
| Model | Resolution | Approximate price |
|---|---|---|
| Seedance Fast | Not specified | $0.152 / second |
| Seedance 2.0 | 720p | $0.190 / second |
| Seedance 2.0 | 1080p | $0.470 / second |
| Seedance 2.5 (doubao-seedance-2-5-1080p, added 2026-10-10) | 1080p | $0.711 / second |
| Seedance native 4K | 4K | $4.90 per 5-second clip |
FAQ
The questions below cover the most common points about using the Vercel AI SDK with RelayDance for Seedance video.
Do I need a separate client for video? Video tasks use /v1/video/generations, so you call that endpoint with fetch. You keep the same base URL and API key that your AI SDK provider uses for text and images.
Which models are available besides Seedance? RelayDance offers Seedance 2.0 and Seedance 1.5 Pro, HappyHorse video models, Grok Imagine video and image models, and Grok text models. Current IDs and rates are listed at relaydance.com/models.
Am I charged if a generation fails? No. You are not charged for failed or errored requests, so you can safely retry after checking the task status.
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 2.5 1080p price | about $0.711 / second, added 2026-10-10, model doubao-seedance-2-5-1080p | 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.