Laravel queue jobs for AI video: PHP integration with the RelayDance API
To integrate RelayDance AI video generation into Laravel, dispatch a queued job that submits POST /v1/video/generations with your model, prompt, and seconds, then poll GET /v1/video/generations/{task_id} until the status is succeeded or failed. RelayDance is OpenAI-compatible, so set base_url to https://relaydance.com/v1 and authenticate with a Bearer key. Long generation times fit Laravel queues well because polling and webhook callbacks run outside the request cycle.
How to configure the RelayDance client in Laravel
Configure RelayDance by pointing your existing OpenAI SDK or HTTP client at the RelayDance base URL. According to the official relaydance.com/docs, "Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK". In Laravel, store the key in config/services.php and read it from your environment. Authentication uses the header Authorization: Bearer YOUR_API_KEY, and keys are created at the RelayDance console. Because the protocol is OpenAI-compatible, you avoid a BytePlus enterprise account or KYC. See the full endpoint reference at https://relaydance.com/docs for request and metadata fields including ratio, resolution, generate_audio, and callback_url.
How to build the queue job that submits and polls
Build a queued job that submits the task, then polls or waits for a webhook. Follow these numbered steps:
- Dispatch a job with the model, prompt, and seconds (clips up to 15 seconds).
- Send
POST /v1/video/generations, addingmetadata.content[]for reference media cited as@image1to@imageN(up to 9 reference images, 3 reference videos, and 3 audio tracks per request). - Read the returned
task_id. - Poll
GET /v1/video/generations/{task_id}until status is succeeded or failed, or setmetadata.callback_urlso the final state is POSTed to your server. - Store the returned video url and mark the job complete.
Webhook mode reduces polling load by delivering the final state to a Laravel route directly.
How RelayDance billing affects queue retry logic
RelayDance bills pay-as-you-go per generated video, so retry logic does not carry unexpected cost for failures. According to the official relaydance.com docs, "Failed or errored requests are never billed", which means Laravel's automatic retry on a transient error will not double-charge you. Live per-model rates are published at https://relaydance.com/models. Current examples include Seedance 2.0 at about $0.190 per second for 720p and about $0.470 per second for 1080p, Seedance Fast at about $0.152 per second, and Seedance native 4K at about $4.90 per 5-second clip. Payments accept USDT and Stripe card.
Model and price reference for planning jobs
Use the table below to estimate cost per queued job from published rates.
| Option | Rate | Unit |
|---|---|---|
| Seedance 2.0 720p | about $0.190 | per second |
| Seedance 2.0 1080p | about $0.470 | per second |
| Seedance Fast | about $0.152 | per second |
| Seedance native 4K | about $4.90 | per 5-second clip |
| gpt-image-2 (image-to-image) | from about CNY 0.035 | per input |
For gpt-image-2, image output is free and only input is billed, and 4K and 1K output cost the same. Confirm all values at https://relaydance.com/models before pricing jobs.
FAQ
Do I need a BytePlus enterprise account to use Seedance through Laravel? No. RelayDance provides direct OpenAI-compatible access to Seedance with no BytePlus enterprise account or KYC required.
What happens to my Laravel job if a request fails? The status returns failed and failed or errored requests are never billed, so retrying is cost-safe.
Can a single request use reference media? Yes. Place media in metadata.content[] and cite them as @image1 to @imageN, up to 9 reference images, 3 reference videos, and 3 audio tracks per request.
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.