Skip to content

Seedream API Examples

Since the Seedream 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 Seedream 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/images/generations
  • Authentication Method: Bearer Token
  • Content Type: application/json

Request Examples

bash
curl --location --request POST 'https://api.agentsflare.com/byteplus/v3/images/generations' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {API-KEY}' \
    --data-raw '{
        "model": "seedream-4-5-251128",
        "prompt": "Vehicle display stand, showcasing a Bugatti Chiron sports car.",
        "size": "2K",
        "stream": true,
        "watermark": false
    }'
python
import requests
import json

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

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

payload = {
    "model": "seedream-4-5-251128",
    "prompt": "Vehicle display stand, showcasing a Bugatti Chiron sports car.",
    "size": "2K",
    "stream": True,
    "watermark": False
}

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

# If it's a streaming response
if payload["stream"]:
    for line in response.iter_lines():
        if line:
            print(line.decode('utf-8'))
else:
    print(response.json())
javascript
const fetch = require('node-fetch');

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

const payload = {
    model: 'seedream-4-5-251128',
    prompt: 'Vehicle display stand, showcasing a Bugatti Chiron sports car.',
    size: '2K',
    stream: true,
    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/images/generations"

	payload := map[string]interface{}{
		"model":     "seedream-4-5-251128",
		"prompt":    "Vehicle display stand, showcasing a Bugatti Chiron sports car.",
		"size":      "2K",
		"stream":    true,
		"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(string(body))
}

Response Example

The response contains the download URL of the image, which you can directly access to download the image.

event: image_generation.partial_succeeded
data: {"type":"image_generation.partial_succeeded","model":"seedream-4-5-251128","created":1768273118,"image_index":0,"url":"https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-5/0217682731093552e69d8f77ebb6ff0d882025244d1e9e0e22d01_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260113%2Fap-southeast-1%2Ftos%2Frequest&X-Tos-Date=20260113T025838Z&X-Tos-Expires=86400&X-Tos-Signature=1a42473d77225a3ea52e3e26523644f154fea4841cd697be3787217ef50293a6&X-Tos-SignedHeaders=host","size":"2848x1600"}

event: image_generation.completed
data: {"type":"image_generation.completed","model":"seedream-4-5-251128","created":1768273118,"usage":{"generated_images":1,"output_tokens":17800,"total_tokens":17800}}

data: [DONE]

Request Parameters

For detailed parameters, see Seedream Request Body

This documentation is licensed under CC BY-SA 4.0.