POST
/
v1
/
ai
/
image_generation
import { JigsawStack } from "jigsawstack";

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

const result = await jigsawstack.image_generation({
  prompt: "A serene mountain landscape with a lake reflecting the sunset",
  aspect_ratio: "16:9",
  steps: 30,
  advance_config: {
    negative_prompt: "blurry, low quality",
    guidance: 7.5,
  },
});

// The result is a Response object containing the image
const imageData = await result.blob();
// Use the imageData in your application

Request Parameters

Body

prompt
string
required

The text prompt to generate the image from. Must be between 1-5000 characters.

aspect_ratio
string
default:"1:1"

The aspect ratio of the generated image.

  • 1:1
  • 16:9
  • 21:9
  • 3:2
  • 2:3
  • 4:5
  • 5:4
  • 3:4
  • 4:3
  • 9:16
  • 9:21
width
number

The width of the image. Must be between 256-1920 pixels.

height
number

The height of the image. Must be between 256-1920 pixels.

steps
number
default:"4"

The number of denoising steps. Must be between 1-90. Higher values produce better quality images but take more time to generate.

advance_config
object
negative_prompt
string

Text describing what you don’t want in the image.

guidance
number

Higher guidance forces the model to better follow the prompt, but may result in lower quality output. Must be between 1-28.

seed
number

Makes generation deterministic. Using the same seed and set of parameters will produce identical image each time.

x-api-key
string
required

Your JigsawStack API key

Response

The API returns the generated image directly in the response body as binary data.

import { JigsawStack } from "jigsawstack";

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

const result = await jigsawstack.image_generation({
  prompt: "A serene mountain landscape with a lake reflecting the sunset",
  aspect_ratio: "16:9",
  steps: 30,
  advance_config: {
    negative_prompt: "blurry, low quality",
    guidance: 7.5,
  },
});

// The result is a Response object containing the image
const imageData = await result.blob();
// Use the imageData in your application