typetext
{
"aspect_ratio": "1:1",
"cfg": 5,
"output_format": "webp",
"output_quality": 90,
"prompt": "a claymation dinosaur with a giant taco in its mouth, set against a bright and colorful background. Holding a sign that says 'Eat Moar Tacos'",
"prompt_strength": 0.85,
"steps": 40
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_513**********************************
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.5-medium using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
cfg: 5,
output_format: "webp",
output_quality: 90,
prompt: "a claymation dinosaur with a giant taco in its mouth, set against a bright and colorful background. Holding a sign that says 'Eat Moar Tacos'",
prompt_strength: 0.85,
steps: 40
};
const output = await replicate.run("stability-ai/stable-diffusion-3.5-medium", { 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_513**********************************
This is your API token. Keep it to yourself.
import replicate
Run stability-ai/stable-diffusion-3.5-medium 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.5-medium",
input={
"aspect_ratio": "1:1",
"cfg": 5,
"output_format": "webp",
"output_quality": 90,
"prompt": "a claymation dinosaur with a giant taco in its mouth, set against a bright and colorful background. Holding a sign that says 'Eat Moar Tacos'",
"prompt_strength": 0.85,
"steps": 40
}
)
# 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_513**********************************
This is your API token. Keep it to yourself.
Run stability-ai/stable-diffusion-3.5-medium 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": "1:1",
"cfg": 5,
"output_format": "webp",
"output_quality": 90,
"prompt": "a claymation dinosaur with a giant taco in its mouth, set against a bright and colorful background. Holding a sign that says \'Eat Moar Tacos\'",
"prompt_strength": 0.85,
"steps": 40
}
}' \
https://api.replicate.com/v1/models/stability-ai/stable-diffusion-3.5-medium/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "4fxgr30xddrm20cjvdvs5eb3yg",
"model": "stability-ai/stable-diffusion-3.5-medium",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"cfg": 5,
"output_format": "webp",
"output_quality": 90,
"prompt": "a claymation dinosaur with a giant taco in its mouth, set against a bright and colorful background. Holding a sign that says 'Eat Moar Tacos'",
"prompt_strength": 0.85,
"steps": 40
},
"logs": "Seed set to: 1814600532\nRunning workflow\ngot prompt\nExecuting node 294, title: KSampler, class type: KSampler\n0%| | 0/40 [00:00<?, ?it/s]\n5%|▌ | 2/40 [00:00<00:03, 10.78it/s]\n10%|█ | 4/40 [00:00<00:03, 10.77it/s]\n15%|█▌ | 6/40 [00:00<00:03, 10.78it/s]\n20%|██ | 8/40 [00:00<00:02, 10.78it/s]\n25%|██▌ | 10/40 [00:00<00:02, 10.79it/s]\n30%|███ | 12/40 [00:01<00:02, 10.78it/s]\n35%|███▌ | 14/40 [00:01<00:02, 10.79it/s]\n40%|████ | 16/40 [00:01<00:02, 10.79it/s]\n45%|████▌ | 18/40 [00:01<00:02, 10.79it/s]\n50%|█████ | 20/40 [00:01<00:01, 10.78it/s]\n55%|█████▌ | 22/40 [00:02<00:01, 10.78it/s]\n60%|██████ | 24/40 [00:02<00:01, 10.78it/s]\n65%|██████▌ | 26/40 [00:02<00:01, 10.78it/s]\n70%|███████ | 28/40 [00:02<00:01, 10.78it/s]\n75%|███████▌ | 30/40 [00:02<00:00, 10.78it/s]\n80%|████████ | 32/40 [00:02<00:00, 10.79it/s]\n85%|████████▌ | 34/40 [00:03<00:00, 10.79it/s]\n90%|█████████ | 36/40 [00:03<00:00, 10.79it/s]\n95%|█████████▌| 38/40 [00:03<00:00, 10.78it/s]\n100%|██████████| 40/40 [00:03<00:00, 10.78it/s]\n100%|██████████| 40/40 [00:03<00:00, 10.78it/s]\nExecuting node 8, title: VAE Decode, class type: VAEDecode\nExecuting node 309, title: Save Image, class type: SaveImage\nPrompt executed in 4.00 seconds\noutputs: {'309': {'images': [{'filename': 'R8_sd3.5L_00001_.png', 'subfolder': '', 'type': 'output'}]}}\n====================================\nR8_sd3.5L_00001_.png",
"output": [
"https://replicate.delivery/yhqm/YX9e3CZKIrzcGaTVgfM8kOe7T2ILoaf8FRPvfWffRFNycz61JA/R8_sd3.5L_00001_.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-10-30T03:27:49.611Z",
"started_at": "2024-10-30T03:27:49.620596Z",
"completed_at": "2024-10-30T03:27:53.884925Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/4fxgr30xddrm20cjvdvs5eb3yg/cancel",
"get": "https://api.replicate.com/v1/predictions/4fxgr30xddrm20cjvdvs5eb3yg",
"stream": "https://stream.replicate.com/v1/files/wcdb-jek5dgi2slvdj7uapp6tspeathbwru4ggvav3cikfc2xk6xqxapq",
"web": "https://replicate.com/p/4fxgr30xddrm20cjvdvs5eb3yg"
},
"metrics": {
"image_count": 1,
"predict_time": 4.264329421,
"total_time": 4.273925
}
}