Skip to content

Quick start ​

Seedance API(v3)

Use https://api.tokenlio.ai with your platform Bearer Key and an exact model ID from the current catalog. Official references provide more field details; use the addresses, authentication and examples on this page for your calls.

Start with one text-to-video request: create, save its id, then query that task for the result. Material management and person verification are optional workflows, not prerequisites for ordinary generation.

Choose a workflow ​

GoalReading order
Generate a first videoCreate video tasks → Query and manage tasks
Reuse image, video or audio materialsMaterial groups and assets → Create video tasks
Verify a person for materialsPerson verification → Material groups and assets → Create video tasks
Receive generation notificationsGeneration callbacks → Query and manage tasks
Let an Agent orchestrate callsAgent integration guide → Request conventions

Quick start ​

Set TOKENLIO_API_KEY and one stable TOKENLIO_IDEMPOTENCY_KEY for this new generation intent. Use a new key for a new intent, but retain the original key/body when recovering uncertainty. These examples make real generation requests; mock the integration logic first.

bash
# 1. Create a video task
curl -sS --fail-with-body -X POST "https://api.tokenlio.ai/api/v3/contents/generations/tasks" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${TOKENLIO_IDEMPOTENCY_KEY:?Set a stable intent key}" \
  --data '{
    "model": "seedance-2.0",
    "content": [
      {
        "type": "text",
        "text": "A paper boat drifts across a rain-lit puddle, slow camera push-in"
      }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "generate_audio": false
  }'

# 2. Query the task; TASK_ID is the id returned by creation
curl -sS --fail-with-body -X GET "https://api.tokenlio.ai/api/v3/contents/generations/tasks/TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"
python
import os
import time
import requests

BASE_URL = "https://api.tokenlio.ai"
headers = {
    "Authorization": f"Bearer {os.environ['TOKENLIO_API_KEY']}",
    "Content-Type": "application/json",
    "Idempotency-Key": os.environ["TOKENLIO_IDEMPOTENCY_KEY"],
}

# 1. Create a video task
payload = {
    "model": "seedance-2.0",
    "content": [
        {
            "type": "text",
            "text": "A paper boat drifts across a rain-lit puddle, slow camera push-in"
        }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "generate_audio": False
}
response = requests.post(
    f"{BASE_URL}/api/v3/contents/generations/tasks",
    headers=headers,
    json=payload,
    timeout=30,
)
response.raise_for_status()
task_id = response.json()["id"]
print("Task ID:", task_id)

# Query a task
while True:
    time.sleep(5)
    response = requests.get(
        f"{BASE_URL}/api/v3/contents/generations/tasks/{task_id}",
        headers=headers,
        timeout=30,
    )
    response.raise_for_status()
    task = response.json()
    if task["status"] == "succeeded":
        print("Video URL:", task["content"]["video_url"])
        break
    if task["status"] in {"failed", "cancelled", "expired"}:
        print("Task status:", task["status"], task.get("error"))
        break
javascript
const baseUrl = "https://api.tokenlio.ai";
if (!process.env.TOKENLIO_IDEMPOTENCY_KEY) throw new Error("Set a stable intent key");
const headers = {
  Authorization: `Bearer ${process.env.TOKENLIO_API_KEY}`,
  "Content-Type": "application/json",
  "Idempotency-Key": process.env.TOKENLIO_IDEMPOTENCY_KEY,
};

// 1. Create a video task
const response = await fetch(`${baseUrl}/api/v3/contents/generations/tasks`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    "model": "seedance-2.0",
    "content": [
      {
        "type": "text",
        "text": "A paper boat drifts across a rain-lit puddle, slow camera push-in"
      }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "generate_audio": false
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const { id } = await response.json();
console.log("Task ID:", id);

// Query a task
while (true) {
  await new Promise(resolve => setTimeout(resolve, 5000));
  const query = await fetch(`${baseUrl}/api/v3/contents/generations/tasks/${id}`, { headers });
  if (!query.ok) throw new Error(`${query.status}: ${await query.text()}`);
  const task = await query.json();
  if (task.status === "succeeded") {
    console.log("Video URL:", task.content.video_url);
    break;
  }
  if (["failed", "cancelled", "expired"].includes(task.status)) {
    console.log("Task status:", task.status, task.error);
    break;
  }
}

Response examples ​

Task accepted ​

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7"
}

Successful task ​

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "seedance-2.0",
  "status": "succeeded",
  "content": {
    "video_url": "https://example.com/result.mp4"
  },
  "resolution": "720p",
  "duration": 5,
  "usage": {
    "completion_tokens": 108900,
    "total_tokens": 108900
  }
}

Creation returns HTTP 200 and the task id. Queries return status, result URLs and usage. content.video_url is temporary; repeated queries do not refresh it.

Next steps ​

Access leading AI models through one unified API