typetext
{
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_L5h**********************************
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 black-forest-labs/flux-schnell using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "latina model"
};
const output = await replicate.run("black-forest-labs/flux-schnell", { 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_L5h**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-schnell using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"black-forest-labs/flux-schnell",
input={
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model"
}
)
# 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_L5h**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-schnell 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",
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model"
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "vtjr9cyxxsrm40chr1f98kvb3m",
"model": "black-forest-labs/flux-schnell",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model"
},
"logs": "Using seed: 61690\n0it [00:00, ?it/s]\n1it [00:00, 7.90it/s]\n2it [00:00, 5.56it/s]\n3it [00:00, 5.08it/s]\n4it [00:00, 4.88it/s]\n4it [00:00, 5.14it/s]\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/yhqm/O9540DDhOcr3AtneKojo7M9gBJQYBRbycc0dK34cgRWpB3sJA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-09-05T04:08:48.366Z",
"started_at": "2024-09-05T04:08:49.125795Z",
"completed_at": "2024-09-05T04:08:50.51079Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/vtjr9cyxxsrm40chr1f98kvb3m/cancel",
"get": "https://api.replicate.com/v1/predictions/vtjr9cyxxsrm40chr1f98kvb3m",
"web": "https://replicate.com/p/vtjr9cyxxsrm40chr1f98kvb3m"
},
"metrics": {
"image_count": 1,
"predict_time": 1.384995364,
"total_time": 2.14479
}
}