Tutorials

Free, Unlimited RunDiffusion API

On this page

This tutorial shows you how to add RunDiffusion image generation to your web application using Puter.js, without needing API keys or backend infrastructure. With Puter.js, you can access RunDiffusion's photorealistic Juggernaut Flux models — Juggernaut Lightning Flux and Juggernaut Pro Flux — directly from client-side JavaScript.

Puter.js uses the User-Pays model, where users of your application cover their own AI costs. This means you, as a developer, don't pay anything for your users' image generation, making your app practically free to run. You can scale to unlimited users and pay nothing for the AI or server usage.

Getting Started

To use Puter.js, import our NPM library in your project:

// npm install @heyputer/puter.js
import { puter } from '@heyputer/puter.js';

Or alternatively, add our script via CDN if you are working directly with HTML, simply add it to the <head> or <body> section of your code:

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

Nothing else is required to start generating images with RunDiffusion's Juggernaut models in your application.

Example 1: Fast generation with Juggernaut Lightning Flux

Juggernaut Lightning Flux is a speed-optimized variant of the Juggernaut Flux family — built on top of FLUX and tuned by RunDiffusion for photorealistic output with low-latency inference. It's a great default when you want quick previews or interactive UI:

puter.ai.txt2img(
    "A photorealistic portrait of a fashion model on a Tokyo street at night, neon reflections on wet pavement, 35mm film aesthetic, shallow depth of field",
    { model: "rundiffusion/juggernaut-lightning-flux" }
)
.then(imageElement => {
    document.body.appendChild(imageElement);
});

Full code example:

<html>
<body>
    <h1>Juggernaut Lightning Flux Image Generation</h1>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.txt2img(
            "A photorealistic portrait of a fashion model on a Tokyo street at night, neon reflections on wet pavement, 35mm film aesthetic, shallow depth of field",
            { model: "rundiffusion/juggernaut-lightning-flux" }
        )
        .then(imageElement => {
            document.body.appendChild(imageElement);
        });
    </script>
</body>
</html>

Example 2: High-fidelity generation with Juggernaut Pro Flux

Juggernaut Pro Flux is the higher-quality tier of the Juggernaut Flux line, tuned for sharper detail, better skin and material rendering, and stronger prompt adherence. Use it when you care more about output quality than throughput:

puter.ai.txt2img(
    "An ultra-detailed product photograph of a vintage leather watch on a marble surface, soft window light, visible stitching, macro lens, commercial photography",
    { model: "rundiffusion/juggernaut-pro-flux" }
)
.then(imageElement => {
    document.body.appendChild(imageElement);
});

Full code example:

<html>
<body>
    <h1>Juggernaut Pro Flux Image Generation</h1>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        puter.ai.txt2img(
            "An ultra-detailed product photograph of a vintage leather watch on a marble surface, soft window light, visible stitching, macro lens, commercial photography",
            { model: "rundiffusion/juggernaut-pro-flux" }
        )
        .then(imageElement => {
            document.body.appendChild(imageElement);
        });
    </script>
</body>
</html>

Supported RunDiffusion Models

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

rundiffusion/juggernaut-lightning-flux
rundiffusion/juggernaut-pro-flux

Conclusion

Using Puter.js, you can integrate RunDiffusion's Juggernaut Flux models into your app without having to use API keys or set up an AI server yourself. And thanks to the User-Pays model, you can add this feature for free to your application, since your users cover their own image generation usage, not you as the developer.

You can find more details about Puter.js image generation API in the documentation.

Free, Serverless AI and Cloud

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

Get Started Now

Read the Docs Try the Playground