Free, Unlimited HiDream API
On this page
This tutorial shows you how to add HiDream image generation to your web application using Puter.js, without needing API keys or backend infrastructure. With Puter.js, you can access HiDream's 17-billion-parameter sparse Diffusion Transformer family — HiDream I1 Full, HiDream I1 Dev, and HiDream I1 Fast — 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>
This is all you need to start generating images with HiDream models in your application.
Example 1: High-fidelity generation with HiDream I1 Full
HiDream I1 Full is the flagship variant — a 17B-parameter sparse Diffusion Transformer that runs 50+ diffusion steps and tops GenEval, DPG-Bench, and HPS v2.1 against models like FLUX.1-dev and DALL-E 3. Use it when image quality and prompt adherence matter most. To generate an image, use the puter.ai.txt2img() function:
puter.ai.txt2img(
"A serene Japanese garden with cherry blossoms and a koi pond",
{ model: "hidream-ai/hidream-i1-full" }
)
.then(imageElement => {
document.body.appendChild(imageElement);
});
Full code example:
<html>
<body>
<h1>HiDream I1 Full Image Generation</h1>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.txt2img(
"A serene Japanese garden with cherry blossoms and a koi pond",
{ model: "hidream-ai/hidream-i1-full" }
)
.then(imageElement => {
document.body.appendChild(imageElement);
});
</script>
</body>
</html>
Example 2: Balanced speed and quality with HiDream I1 Dev
HiDream I1 Dev is the guidance-distilled middle variant — about 28 diffusion steps, no negative prompts required, and a guidance scale of 1.0. It's a strong default for iterative workflows where you want quality close to the Full variant without paying its full latency cost:
puter.ai.txt2img(
"A cyberpunk cityscape with neon lights and flying vehicles",
{ model: "hidream-ai/hidream-i1-dev" }
)
.then(imageElement => {
document.body.appendChild(imageElement);
});
Full code example:
<html>
<body>
<h1>HiDream I1 Dev Image Generation</h1>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.txt2img(
"A cyberpunk cityscape with neon lights and flying vehicles",
{ model: "hidream-ai/hidream-i1-dev" }
)
.then(imageElement => {
document.body.appendChild(imageElement);
});
</script>
</body>
</html>
Example 3: Low-latency generation with HiDream I1 Fast
HiDream I1 Fast finishes in as few as 14-16 diffusion steps, making it ideal for real-time UIs, high-throughput pipelines, or anywhere responsiveness is the top priority:
puter.ai.txt2img(
"A cute corgi astronaut floating in zero gravity, vivid colors, highly detailed",
{ model: "hidream-ai/hidream-i1-fast" }
)
.then(imageElement => {
document.body.appendChild(imageElement);
});
Full code example:
<html>
<body>
<h1>HiDream I1 Fast Image Generation</h1>
<button onclick="generateImage()">Generate Image</button>
<div id="imageContainer"></div>
<script src="https://js.puter.com/v2/"></script>
<script>
function generateImage() {
document.getElementById('imageContainer').innerHTML = 'Generating...';
puter.ai.txt2img(
"A cute corgi astronaut floating in zero gravity, vivid colors, highly detailed",
{ model: "hidream-ai/hidream-i1-fast" }
)
.then(imageElement => {
document.getElementById('imageContainer').innerHTML = '';
document.getElementById('imageContainer').appendChild(imageElement);
});
}
</script>
</body>
</html>
Supported HiDream Models
The following HiDream models are supported by Puter.js, which can be used with the puter.ai.txt2img() function:
hidream-ai/hidream-i1-full
hidream-ai/hidream-i1-dev
hidream-ai/hidream-i1-fast
Conclusion
Using Puter.js, you can integrate HiDream image generation 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.
Related
- Free, Unlimited FLUX AI API
- Free, Unlimited GPT Image API
- Free, Unlimited Imagen API
- Free, Unlimited Nano Banana API
- Free, Unlimited Stable Diffusion API
- Free, Unlimited ByteDance Seedream API
- Free, Unlimited Leonardo.Ai API
- Free, Unlimited Ideogram API
- Free, Unlimited Image Generation API
- Free, Unlimited OpenAI API
- Free, Unlimited Claude API
- Free, Unlimited AI API
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now