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

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Consultant Senior Power BI & Azure - CDI - H/F

@ Talan | Lyon, France