LogoMkSaaS文档
LogoMkSaaS文档
首页

快速上手

Welcome to rlay.aiQuickstartMigrate from fal.ai

接口

Generate imagesGenerate videosError codes
X (Twitter)

Generate videos

Veo 3.1, Sora 2, Kling 3.0 — async polling pattern

Video generation is asynchronous: submit returns a jobId immediately, then poll /v1/jobs/{jobId} until the job completes.

1. Submit

curl https://api.rlay.ai/v1/videos \
  -H "Authorization: Bearer $RLAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1",
    "prompt": "a cat surfing on neon waves",
    "duration": 5,
    "resolution": "720p"
  }'

Response:

{ "jobId": "job_a3f7...", "status": "pending" }

2. Poll

curl https://api.rlay.ai/v1/jobs/job_a3f7... \
  -H "Authorization: Bearer $RLAY_KEY"

Response while running:

{ "jobId": "job_a3f7...", "status": "processing" }

Response when done:

{
  "jobId": "job_a3f7...",
  "status": "completed",
  "resultUrl": "https://cdn.rlay.ai/...",
  "creditsCost": 1.15,
  "completedAt": "2026-05-05T12:42:10Z"
}

Polling cadence

  • First poll after 5 seconds, then exponential backoff capped at 30s.
  • Most jobs settle within 20-90s depending on duration and model.
  • A 4xx response means the job failed — check errorMsg.

Available models

ModelBest forPrice
veo-3.1Cinematic, 720p, 5-12s$0.23/s
sora-2Long-form coherent, 1080p, 20s+$0.20/s
kling-3Camera control, realistic, 10s$0.12/s
seedance-2Image-to-video, fast, 5s$0.08/s

Credits and refunds

Credits are only deducted on successful completion. Failed jobs cost nothing.

Error codes→

Handle failures gracefully

Migrate from fal.ai→

Map fal endpoints to rlay

Generate images

Flux 2, GPT Image, Midjourney V7, Seedream

Error codes

401 / 402 / 400 / 429 / 5xx — what they mean and how to fix

目录

1. Submit
2. Poll
Polling cadence
Available models
Credits and refunds