Generate an image based on the given text by employing AI models like Flux, Stable Diffusion, DALL·E, and other top models.

Initial requirements

  • Setup a JigsawStack account (if you don’t have an account already)
  • Get your API key from here.
  • Install the Node.js SDK

Basic usage

import { JigsawStack } from "jigsawstack";

const jigsawstack = JigsawStack({
  apiKey: "your-api-key",
});

const result = await jigsawstack.image_generation({
  prompt: "cute siamese cat playing with yarn in a sunlit room",
});

const data = await result.blob();

Specify the image aspect rato

Supported ratios are:

  • 1:1
  • 16:9
  • 21:9
  • 3:2
  • 2:3
  • 4:5
  • 5:4
  • 3:4
  • 4:3
  • 9:16
  • 9:21
import { JigsawStack } from "jigsawstack";

const jigsawstack = JigsawStack({
  apiKey: "your-api-key",
});

const result = await jigsawstack.image_generation({
  prompt: "cute siamese cat playing with yarn in a sunlit room",
  aspect_ratio: "1:1",
});

const data = await result.blob();