Skip to content

Quickstart

Generate a 5-second, 720p video with seedance2.0. Have your API key ready, then use either the cURL or Node.js examples below.

Generate your first image
Images use a synchronous API. Open the complete GPT-Image cURL and Node.js examples.

1. Prepare your API key

Sign in to the console, check your wallet balance, and create a key under API keys. Replace VIDEO_API_KEY below with your key.

Create an account
Already have an account? Sign in to the console.
Open console
Check your balance and create an API key.
Set environment variables in your server terminalbash
export VIDEO_API_BASE="https://ling-light.com"
export VIDEO_API_KEY="sk-your-api-key"
# Generate once per new business request; keep it for retries.
export VIDEO_REQUEST_ID="$(uuidgen)"

Run cURL examples in your terminal. For Node.js, use version 22 or later; the examples use built-in fetch with no SDK. Save each as an .mjs file and run node filename.mjs in the terminal where you set the environment variables. Keep your API key on the server.

2. Choose a model

The examples use seedance2.0 at 5 seconds and 720p. To use another model, list the models available to your key, replace model, and choose a supported duration and resolution.

Models and prices
Check model descriptions, resolutions and prices.
List models available to your API key
curl "$VIDEO_API_BASE/v1/models" \
  --header "Authorization: Bearer $VIDEO_API_KEY"
const baseUrl = process.env.VIDEO_API_BASE
const apiKey = process.env.VIDEO_API_KEY
if (!baseUrl || !apiKey) throw new Error('Set VIDEO_API_BASE and VIDEO_API_KEY first')

async function call(path, init = {}) {
  const response = await fetch(new URL(path, baseUrl), {
    ...init,
    signal: AbortSignal.timeout(30_000),
    headers: {
      Authorization: `Bearer ${apiKey}`,
      Accept: 'application/json',
      ...(init.body ? { 'Content-Type': 'application/json' } : {}),
      ...init.headers,
    },
  })
  const body = await response.json()
  if (!response.ok || body.error) {
    throw new Error(`HTTP ${response.status}: ${body.message || body.error?.message || 'Request failed'}`)
  }
  return body
}

console.log(await call('/v1/models'))

3. Create your first video task

Create a video task
curl --request POST "$VIDEO_API_BASE/v1/videos" \
  --header "Authorization: Bearer $VIDEO_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $VIDEO_REQUEST_ID" \
  --data '{
  "model": "seedance2.0",
  "prompt": "An orange cat watching rain from a windowsill, slow camera push-in",
  "seconds": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}'
const baseUrl = process.env.VIDEO_API_BASE
const apiKey = process.env.VIDEO_API_KEY
if (!baseUrl || !apiKey) throw new Error('Set VIDEO_API_BASE and VIDEO_API_KEY first')

async function call(path, init = {}) {
  const response = await fetch(new URL(path, baseUrl), {
    ...init,
    signal: AbortSignal.timeout(30_000),
    headers: {
      Authorization: `Bearer ${apiKey}`,
      Accept: 'application/json',
      ...(init.body ? { 'Content-Type': 'application/json' } : {}),
      ...init.headers,
    },
  })
  const body = await response.json()
  if (!response.ok || body.error) {
    throw new Error(`HTTP ${response.status}: ${body.message || body.error?.message || 'Request failed'}`)
  }
  return body
}

// Keep this ID and the identical body when retrying this business request.
const requestId = process.env.VIDEO_REQUEST_ID
if (!requestId) throw new Error('Set VIDEO_REQUEST_ID first')
const task = await call('/v1/videos', {
  method: 'POST',
  headers: { 'Idempotency-Key': requestId },
  body: JSON.stringify({
  "model": "seedance2.0",
  "prompt": "An orange cat watching rain from a windowsill, slow camera push-in",
  "seconds": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}),
})
console.log(task)
Create task response · save idjson
{
  "id": "task_xxxxxxxxxxxxxxxx",
  "object": "video",
  "model": "seedance2.0",
  "status": "queued",
  "progress": 0,
  "seconds": "5",
  "metadata": {
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }
}

Set VIDEO_TASK_ID to the returned id before running the query below. If a request times out, retry with the same VIDEO_REQUEST_ID and body. Generate a new VIDEO_REQUEST_ID for each new task.

4. Wait for completion

Query the task · automatic polling with Node.js
# Replace with the id from the create response.
export VIDEO_TASK_ID="task_xxxxxxxxxxxxxxxx"
# Run every 3–5 seconds until completed or failed.
curl "$VIDEO_API_BASE/v1/videos/$VIDEO_TASK_ID" \
  --header "Authorization: Bearer $VIDEO_API_KEY"
const baseUrl = process.env.VIDEO_API_BASE
const apiKey = process.env.VIDEO_API_KEY
if (!baseUrl || !apiKey) throw new Error('Set VIDEO_API_BASE and VIDEO_API_KEY first')

async function call(path, init = {}) {
  const response = await fetch(new URL(path, baseUrl), {
    ...init,
    signal: AbortSignal.timeout(30_000),
    headers: {
      Authorization: `Bearer ${apiKey}`,
      Accept: 'application/json',
      ...(init.body ? { 'Content-Type': 'application/json' } : {}),
      ...init.headers,
    },
  })
  const body = await response.json()
  if (!response.ok || body.error) {
    throw new Error(`HTTP ${response.status}: ${body.message || body.error?.message || 'Request failed'}`)
  }
  return body
}

const taskId = process.env.VIDEO_TASK_ID
if (!taskId) throw new Error('Set VIDEO_TASK_ID to the id from the create response')
const deadline = Date.now() + 20 * 60_000
let task
while (Date.now() < deadline) {
  task = await call(`/v1/videos/${encodeURIComponent(taskId)}`)
  if (task.status === 'failed') throw new Error(task.error?.message || 'Video generation failed')
  if (task.status === 'completed') break
  await new Promise(resolve => setTimeout(resolve, 4000))
}
if (task?.status !== 'completed') {
  throw new Error('Polling stopped after 20 minutes. Resume querying the same task ID; do not create another task.')
}
console.log(task.metadata?.url)
Completed task response · read metadata.urljson
{
  "id": "task_xxxxxxxxxxxxxxxx",
  "object": "video",
  "model": "seedance2.0",
  "status": "completed",
  "progress": 100,
  "seconds": "5",
  "metadata": {
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "url": "https://media.example.com/videos/task_xxxxxxxxxxxxxxxx.mp4"
  }
}

5. Get your video

When status is completed, metadata.url contains the video URL. On failed, stop polling and read error.message. Public video URLs need no API key. For same-site /v1/videos/{id}/content URLs, download from your server with the API key used to create the task. Save videos you need to keep.

Integration guide
Request parameters, media examples and error handling.
Models
Models and prices by resolution.
Last updated