Tutorials

Free, Unlimited ByteDance Seedream API

This tutorial shows how to use Puter.js for generating images with ByteDance Seedream AI models for free, without needing API keys or backend infrastructure. With Puter.js, you gain immediate access to Seedream models such as Seedream 4.0 and Seedream 3.0, all callable directly from client-side JavaScript.

Through Puter's "User-Pays" model, you can integrate advanced AI image generation into your apps while users cover their individual usage costs. This approach lets you deliver professional-grade image generation features without incurring costs, managing API credentials, or configuring server infrastructure.

Getting Started

Using Puter.js requires zero configuration and no API keys. Simply add this script tag to your HTML file (works in both <head> and <body> sections):

<script src="https://js.puter.com/v2/"></script>

This single script tag is all you need to start generating images with ByteDance Seedream models in your application.

Example 1: Generate an image with Seedream 4.0

To generate an image using Seedream 4.0, use the puter.ai.txt2img() function:

puter.ai.txt2img(
    "A futuristic cityscape at sunset with flying cars and towering skyscrapers",
    { model: "ByteDance-Seed/Seedream-4.0", provider: "together-ai", disable_safety_checker: true }
)
.then(imageElement => {
    document.body.appendChild(imageElement);
});

Full code example:

<html>
<body>
    <h1>Seedream 4.0 Image Generation</h1>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.txt2img(
            "A futuristic cityscape at sunset with flying cars and towering skyscrapers",
            { model: "ByteDance-Seed/Seedream-4.0", provider: "together-ai", disable_safety_checker: true }
        )
        .then(imageElement => {
            document.body.appendChild(imageElement);
        });
    </script>
</body>
</html>

Example 2: Generate an image with Seedream 3.0 (Cost-Effective)

To generate an image using the cost-effective Seedream 3.0 model, simply change the model parameter:

puter.ai.txt2img(
    "A magical forest with glowing mushrooms and mystical creatures",
    { model: "ByteDance-Seed/Seedream-3.0", provider: "together-ai", disable_safety_checker: true }
)
.then(imageElement => {
    document.body.appendChild(imageElement);
});

Full code example:

<html>
<body>
    <h1>Seedream 3.0 Image Generation</h1>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.txt2img(
            "A magical forest with glowing mushrooms and mystical creatures",
            { model: "ByteDance-Seed/Seedream-3.0", provider: "together-ai", disable_safety_checker: true }
        )
        .then(imageElement => {
            document.body.appendChild(imageElement);
        });
    </script>
</body>
</html>

Example 3: Advanced Generation with Custom Parameters

This example demonstrates advanced options like custom dimensions, and seed control for more precise image generation:

puter.ai.txt2img(
    "A majestic dragon perched on a mountain peak, fantasy art style, detailed scales, dramatic lighting",
    {
        model: "ByteDance-Seed/Seedream-4.0",
        provider: "together-ai",
        disable_safety_checker: true,
        width: 960,
        height: 960,
        seed: 42, // Same seed will produce consistent results
    }
)
.then(imageElement => {
    document.body.appendChild(imageElement);
});

Full code example:

<html>
<body>
    <h1>Advanced Seedream 4.0 Image Generation</h1>
    <button onclick="generateImage()">Generate Dragon Art</button>
    <div id="imageContainer"></div>

    <script src="https://js.puter.com/v2/"></script>
    <script>
        function generateImage() {
            // Clear previous image
            document.getElementById('imageContainer').innerHTML = 'Generating...';

            puter.ai.txt2img(
                "A majestic dragon perched on a mountain peak, fantasy art style, detailed scales, dramatic lighting",
                {
                    model: "ByteDance-Seed/Seedream-4.0",
                    provider: "together-ai",
                    disable_safety_checker: true,
                    width: 960,
                    height: 960,
                    seed: 42, // Same seed will produce consistent results
                }
            )
            .then(imageElement => {
                document.getElementById('imageContainer').innerHTML = '';
                document.getElementById('imageContainer').appendChild(imageElement);
            });
        }
    </script>
</body>
</html>

Supported ByteDance Seedream Models

The following ByteDance Seedream models are supported by Puter.js, which can be used with the puter.ai.txt2img() function:

ByteDance-Seed/Seedream-4.0
ByteDance-Seed/Seedream-3.0



You're all set! With Puter.js, you've unlocked free access to ByteDance Seedream models. Build stunning AI-powered image generation features into your apps—no API keys to manage, no backend servers to maintain, and zero infrastructure costs. Experience truly serverless image generation with Seedream!

Related

Free, Serverless AI and Cloud

Start creating powerful web applications with Puter.js in seconds!

Get Started Now

Read the Docs Try the Playground