Skip to content

Seedance API Examples

Since the Seedance model is a multimodal model, the OpenAI SDK currently does not support direct access to this model. You need to use the request method to access the Seedance model.

Basic Configuration

Before starting to use the API, please ensure you have obtained an API Key. If not, please refer to Create API Key.

Basic Information

  • API Base URL: https://api.agentsflare.com/byteplus/v3/contents/generations/tasks
  • Authentication Method: Bearer Token
  • Content Type: application/json

Request Examples

Create Video

bash
curl --location --request POST 'https://api.agentsflare.com/byteplus/v3/contents/generations/tasks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {API-KEY}' \
--data-raw '{
    "model": "dreamina-seedance-2-0-260128",
    "content": [
        {
            "type": "text",
            "text": "The lady in the picture drives a sports car out of the podium and crashes through the exhibition hall glass."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://*******.jpeg|png...."
            }
        }
    ],
    "ratio": "adaptive",
    "duration": 6,
    "watermark": false
}'
python
import requests
import json

url = "https://api.agentsflare.com/byteplus/v3/contents/generations/tasks"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {API-KEY}"
}

payload = {
    "model": "dreamina-seedance-2-0-260128",
    "content": [
        {
            "type": "text",
            "text": "The lady in the picture drives a sports car out of the podium and crashes through the exhibition hall glass."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://*******.jpeg|png...."
            }
        }
    ],
    "ratio": "adaptive",
    "duration": 6,
    "watermark": False
}

response = requests.post(url, headers=headers, json=payload)

print(response.status_code)
print(response.json())
javascript
const fetch = require('node-fetch');

const url = 'https://api.agentsflare.com/byteplus/v3/contents/generations/tasks';

const payload = {
    model: 'dreamina-seedance-2-0-260128',
    content: [
        {
            type: 'text',
            text: 'The lady in the picture drives a sports car out of the podium and crashes through the exhibition hall glass.'
        },
        {
            type: 'image_url',
            image_url: {
                url: 'https://*******.jpeg|png....'
            }
        }
    ],
    ratio: 'adaptive',
    duration: 6,
    watermark: false
};

const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer {API-KEY}'
    },
    body: JSON.stringify(payload)
};

fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => {
        console.error('Error:', error);
    });
go

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://api.agentsflare.com/byteplus/v3/contents/generations/tasks"

	payload := map[string]interface{}{
		"model": "dreamina-seedance-2-0-260128",
		"content": []map[string]interface{}{
			{
				"type": "text",
				"text": "The lady in the picture drives a sports car out of the podium and crashes through the exhibition hall glass.",
			},
			{
				"type": "image_url",
				"image_url": map[string]string{
					"url": "https://*******.jpeg|png....",
				},
			},
		},
		"ratio":     "adaptive",
		"duration":  6,
		"watermark": false,
	}

	jsonData, err := json.Marshal(payload)
	if err != nil {
		fmt.Println("Error marshaling JSON:", err)
		return
	}

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}

	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer {API-KEY}")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response:", err)
		return
	}

	fmt.Println("Status:", resp.StatusCode)
	fmt.Println("Response:", string(body))
}

Response Example

After successful creation, returns the task ID, which you can use to query task status and download the video.

json
{
  "id": "cgt-2026******-****"
}

File Retrieval

bash
curl --location --request GET 'https://api.agentsflare.com/byteplus/v3/contents/generations/tasks/cgt-2026******-****' \
--header 'Authorization: Bearer {API-KEY}'
python
import requests

url = "https://api.agentsflare.com/byteplus/v3/contents/generations/tasks/cgt-2026******-****"

headers = {
    "Authorization": "Bearer {API-KEY}"
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
javascript
const fetch = require('node-fetch');

const url = 'https://api.agentsflare.com/byteplus/v3/contents/generations/tasks/cgt-2026******-****';

const options = {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer {API-KEY}'
    }
};

fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => {
        console.error('Error:', error);
    });
go

package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://api.agentsflare.com/byteplus/v3/contents/generations/tasks/cgt-2026******-****"

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}

	req.Header.Set("Authorization", "Bearer {API-KEY}")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response:", err)
		return
	}

	fmt.Println("Status:", resp.StatusCode)
	fmt.Println("Response:", string(body))
}

Response Example

The video status response contains the video download URL, which you can directly access to download the video.

json
{
    "id": "cgt-2026******-****",
    "model": "dreamina-seedance-2-0-260128",
    "status": "succeeded",
    "content": {
        "video_url": "https://ark-content-generation-ap-southeast-1.tos-ap-southeast-1.volces.com/seedance-1-0-pro/021768294532558000000000ffffc0a8bc10474251.mp4?X************"
    },
    "usage": {
        "completion_tokens": 295800,
        "total_tokens": 295800
    },
    "created_at": 1768294532,
    "updated_at": 1768294581,
    "seed": 44457,
    "resolution": "1080p",
    "ratio": "16:9",
    "duration": 6,
    "framespersecond": 24,
    "service_tier": "default",
    "execution_expires_after": 172800,
    "draft": false
}

BytePlus Native Request Parameters

ParameterRequiredDescription
modelYesModel name, e.g. dreamina-seedance-2-0-260128
contentYesArray of text/image objects for the prompt
ratioOptionalAspect ratio, e.g. 16:9, 9:16, adaptive
durationOptionalVideo duration in seconds
watermarkOptionalWhether to add a watermark (true / false)
seedOptionalRandom seed (integer) for reproducibility
camera_fixedOptionalLock camera movement (true / false)
framesOptionalTotal frames (alternative to duration, choose one)
return_last_frameOptionalReturn the last frame as an image (true / false)

Alternative: OpenAI-Compatible /v1/videos/generations

In addition to the BytePlus native API above, Agentsflare also supports the OpenAI-compatible /v1/videos/generations endpoint for Seedance. This endpoint uses a simpler prompt + duration style and is useful for integrations that expect the videos.generate interface.

For more request methods and parameters, see Seedance Request Parameters.

bash
curl https://api.agentsflare.com/v1/videos/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "seedance",
    "prompt": "A bird flying over mountains",
    "duration": 5
  }'
python
from openai import OpenAI

url = "https://api.agentsflare.com/v1"

client = OpenAI(
    base_url=url,
    api_key="YOUR_API_KEY"
)

video = client.videos.generate(
    model="seedance",
    prompt="A bird flying over mountains",
    duration=5
)

print(video.data[0].url)

Response Example

{
  "created": 1589478378,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Request Parameters

For detailed parameters, see Videos API.

Supported Models

The following models are available through this interface (sorted by recommendation):

  • dreamina-seedance-2-0-260128 New
  • dreamina-seedance-2-0-fast-260128 New
  • seedance-1-5-pro-251215
  • seedance-1-0-pro-fast-251015
  • seedance-1-0-lite-t2v-250428
  • seedance-1-0-lite-i2v-250428

💡 Tip

The model field in the request example can be replaced with any model name above.

This documentation is licensed under CC BY-SA 4.0.