Skip to main content
POST
/
v1
/
ai
/
image_generation
import { JigsawStack } from "jigsawstack";

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

const response = await jigsaw.image_generation({
  "prompt": "A beautiful sunset over a calm ocean",
  "return_type": "url"
})
{
  "success": true,
  "url": "https://jigsawstack-temp.b1e91a466694ad4af04df5d05ca12d93.r2.cloudflarestorage.com/temp/f78349bc-0d35-4461-9a71-496527fcd49f.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=7b9a19349842b7b1a9e4c2e19f05b232%2F20250916%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250916T185133Z&X-Amz-Expires=604800&X-Amz-Signature=c995f70db449843f4042bdac278acbbd349a64635e777afb78d7b41a01f7c5f0&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject",
  "_usage": {
        "input_tokens": 18,
        "output_tokens": 77,
        "inference_time_tokens": 2030,
        "total_tokens": 2125
  }
}

The image generation API is depracated and no longer being maintained.

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.
output_format
string
default:"png"
The output format of the generated image. Must be one of the following values:
  • png
  • svg
url
string
The image url.
file_store_key
string
The key used to store the image on Jigsawstack file. Learn more about how to handle files in Jigsawstack’s Handling Files section.
Passing in files is used for image edits
advance_config
object
return_type
string
The specified return type for the response
  • url
  • base64
  • binary
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 jigsaw = JigsawStack({ apiKey: "your-api-key" });

const response = await jigsaw.image_generation({
  "prompt": "A beautiful sunset over a calm ocean",
  "return_type": "url"
})
{
  "success": true,
  "url": "https://jigsawstack-temp.b1e91a466694ad4af04df5d05ca12d93.r2.cloudflarestorage.com/temp/f78349bc-0d35-4461-9a71-496527fcd49f.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=7b9a19349842b7b1a9e4c2e19f05b232%2F20250916%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250916T185133Z&X-Amz-Expires=604800&X-Amz-Signature=c995f70db449843f4042bdac278acbbd349a64635e777afb78d7b41a01f7c5f0&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject",
  "_usage": {
        "input_tokens": 18,
        "output_tokens": 77,
        "inference_time_tokens": 2030,
        "total_tokens": 2125
  }
}
I