typetext
{
"aspect_ratio": "2:3",
"cfg": 4.49,
"negative_prompt": "penis, vagina, sex, boobs, pussy, breasts, nipples, laying",
"output_format": "webp",
"output_quality": 100,
"prompt": "4K photo, Nordic minimalism, Medium length photo of an african woman showing her hands"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_eo8**********************************
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 stability-ai/stable-diffusion-3 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "2:3",
cfg: 4.49,
negative_prompt: "penis, vagina, sex, boobs, pussy, breasts, nipples, laying",
output_format: "webp",
output_quality: 100,
prompt: "4K photo, Nordic minimalism, Medium length photo of an african woman showing her hands"
};
const output = await replicate.run("stability-ai/stable-diffusion-3", { input });
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
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_eo8**********************************
This is your API token. Keep it to yourself.
import replicate
Run stability-ai/stable-diffusion-3 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"stability-ai/stable-diffusion-3",
input={
"aspect_ratio": "2:3",
"cfg": 4.49,
"negative_prompt": "penis, vagina, sex, boobs, pussy, breasts, nipples, laying",
"output_format": "webp",
"output_quality": 100,
"prompt": "4K photo, Nordic minimalism, Medium length photo of an african woman showing her hands"
}
)
# To access the file URL:
print(output[0].url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output[0].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_eo8**********************************
This is your API token. Keep it to yourself.
Run stability-ai/stable-diffusion-3 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 $'{
"input": {
"aspect_ratio": "2:3",
"cfg": 4.49,
"negative_prompt": "penis, vagina, sex, boobs, pussy, breasts, nipples, laying",
"output_format": "webp",
"output_quality": 100,
"prompt": "4K photo, Nordic minimalism, Medium length photo of an african woman showing her hands"
}
}' \
https://api.replicate.com/v1/models/stability-ai/stable-diffusion-3/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "0am8c033zsrh60cg49aag26vjc",
"model": "stability-ai/stable-diffusion-3",
"version": "hidden",
"input": {
"aspect_ratio": "2:3",
"cfg": 4.49,
"negative_prompt": "penis, vagina, sex, boobs, pussy, breasts, nipples, laying",
"output_format": "webp",
"output_quality": 100,
"prompt": "4K photo, Nordic minimalism, Medium length photo of an african woman showing her hands"
},
"logs": "Random seed set to: 2352263558\nRunning workflow\ngot prompt\nExecuting node 6, title: CLIP Text Encode (Prompt), class type: CLIPTextEncode\nExecuting node 71, title: CLIP Text Encode (Negative Prompt), class type: CLIPTextEncode\nExecuting node 67, title: ConditioningZeroOut, class type: ConditioningZeroOut\nExecuting node 68, title: ConditioningSetTimestepRange, class type: ConditioningSetTimestepRange\nExecuting node 70, title: ConditioningSetTimestepRange, class type: ConditioningSetTimestepRange\nExecuting node 69, title: Conditioning (Combine), class type: ConditioningCombine\nExecuting node 135, title: EmptySD3LatentImage, class type: EmptySD3LatentImage\nExecuting node 271, title: KSampler, class type: KSampler\n 0%| | 0/28 [00:00<?, ?it/s]\n 4%|▎ | 1/28 [00:00<00:03, 8.52it/s]\n 7%|▋ | 2/28 [00:00<00:03, 7.34it/s]\n 14%|█▍ | 4/28 [00:00<00:02, 9.26it/s]\n 21%|██▏ | 6/28 [00:00<00:02, 10.01it/s]\n 29%|██▊ | 8/28 [00:00<00:01, 10.39it/s]\n 36%|███▌ | 10/28 [00:00<00:01, 10.60it/s]\n 43%|████▎ | 12/28 [00:01<00:01, 10.72it/s]\n 50%|█████ | 14/28 [00:01<00:01, 10.81it/s]\n 57%|█████▋ | 16/28 [00:01<00:01, 10.86it/s]\n 64%|██████▍ | 18/28 [00:01<00:00, 10.92it/s]\n 71%|███████▏ | 20/28 [00:01<00:00, 10.94it/s]\n 79%|███████▊ | 22/28 [00:02<00:00, 10.94it/s]\n 86%|████████▌ | 24/28 [00:02<00:00, 10.93it/s]\n 93%|█████████▎| 26/28 [00:02<00:00, 10.95it/s]\n100%|██████████| 28/28 [00:02<00:00, 10.97it/s]\n100%|██████████| 28/28 [00:02<00:00, 10.63it/s]\nExecuting node 231, title: VAE Decode, class type: VAEDecode\nExecuting node 273, title: Save Image, class type: SaveImage\nPrompt executed in 5.20 seconds\noutputs: {'273': {'images': [{'filename': 'R8_SD3_00001_.png', 'subfolder': '', 'type': 'output'}]}}\n====================================\nR8_SD3_00001_.png",
"output": [
"https://replicate.delivery/pbxt/1vmHTeHjRs2JXyk31RcIjRvpAEGmGGPYII0hJrfjywxfRceLB/R8_SD3_00001_.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-06-16T18:34:34.366Z",
"started_at": "2024-06-16T18:34:34.374167Z",
"completed_at": "2024-06-16T18:34:40.042402Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/0am8c033zsrh60cg49aag26vjc/cancel",
"get": "https://api.replicate.com/v1/predictions/0am8c033zsrh60cg49aag26vjc",
"web": "https://replicate.com/p/0am8c033zsrh60cg49aag26vjc"
},
"metrics": {
"predict_time": 5.66823467,
"total_time": 5.676402
}
}