typetext
{
"guidance_scale": 0,
"image_height": 1024,
"image_width": 1024,
"num_images": 1,
"num_inference_steps": 4,
"output_format": "jpg",
"output_quality": 80,
"prompt": "self-portrait of a woman, lightning in the background",
"seed": 42
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_RYu**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run prunaai/sdxl-lightning using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"prunaai/sdxl-lightning:123d4264aec4d1c81d8bf142e0d90d6fd4c346f1a869406019f6d1653882d7c3",
{
input: {
guidance_scale: 0,
image_height: 1024,
image_width: 1024,
num_images: 1,
num_inference_steps: 4,
output_format: "jpg",
output_quality: 80,
prompt: "self-portrait of a woman, lightning in the background",
seed: 42
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_RYu**********************************
This is your API token. Keep it to yourself.
import replicate
Run prunaai/sdxl-lightning using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"prunaai/sdxl-lightning:123d4264aec4d1c81d8bf142e0d90d6fd4c346f1a869406019f6d1653882d7c3",
input={
"guidance_scale": 0,
"image_height": 1024,
"image_width": 1024,
"num_images": 1,
"num_inference_steps": 4,
"output_format": "jpg",
"output_quality": 80,
"prompt": "self-portrait of a woman, lightning in the background",
"seed": 42
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_RYu**********************************
This is your API token. Keep it to yourself.
Run prunaai/sdxl-lightning using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "prunaai/sdxl-lightning:123d4264aec4d1c81d8bf142e0d90d6fd4c346f1a869406019f6d1653882d7c3",
"input": {
"guidance_scale": 0,
"image_height": 1024,
"image_width": 1024,
"num_images": 1,
"num_inference_steps": 4,
"output_format": "jpg",
"output_quality": 80,
"prompt": "self-portrait of a woman, lightning in the background",
"seed": 42
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "s95hh10fvhrj40cqbdgaag8nac",
"model": "prunaai/sdxl-lightning",
"version": "123d4264aec4d1c81d8bf142e0d90d6fd4c346f1a869406019f6d1653882d7c3",
"input": {
"guidance_scale": 0,
"image_height": 1024,
"image_width": 1024,
"num_images": 1,
"num_inference_steps": 4,
"output_format": "jpg",
"output_quality": 80,
"prompt": "self-portrait of a woman, lightning in the background",
"seed": 42
},
"logs": "0%| | 0/4 [00:00<?, ?it/s]\n100%|██████████| 4/4 [00:00<00:00, 30.27it/s]",
"output": "https://replicate.delivery/yhqm/i8Up1UyeK50JdCsReIXlHSOz8WQlyeKlvuSqQeUEXOhgUPWTB/output_42_0.jpeg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-06-10T19:45:11.644Z",
"started_at": "2025-06-10T19:45:11.650658Z",
"completed_at": "2025-06-10T19:45:12.058263Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/s95hh10fvhrj40cqbdgaag8nac/cancel",
"get": "https://api.replicate.com/v1/predictions/s95hh10fvhrj40cqbdgaag8nac",
"stream": "https://stream.replicate.com/v1/files/qoxq-pow72jpbggvvoc732dk7aug2j2vqhxmyne5vkyfd4g3r7t2ij66q",
"web": "https://replicate.com/p/s95hh10fvhrj40cqbdgaag8nac"
},
"metrics": {
"predict_time": 0.407605154,
"total_time": 0.414263
}
}