April 22, 2024, 12:37 p.m. | Titus Efferian

DEV Community dev.to

Stable Diffusion 3 from Stability AI has now been released and is available for public use. However, they currently only offer a REST API to test these models. Therefore, I tried using this on my local machine using Node.js code.



import fs from "node:fs";
import axios from "axios";
import FormData from "form-data";

const formData = {
prompt: "prompt",
output_format: "png",
aspect_ratio: "16:9",
seed: "645,508,968",
};

const response = await axios.postForm(
`https://api.stability.ai/v2beta/stable-image/generate/sd3`,
axios.toFormData(formData, new FormData()),
{
validateStatus: undefined,
responseType: "arraybuffer",
headers: …

ai api axios code diffusion generate generativeai however image import javascript machine node node.js public rest rest api stability stability ai stable diffusion stable diffusion 3 test

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York