typetext
{
"aspect_ratio": "1:1",
"output_format": "webp",
"output_quality": 80,
"prompt": "black forest gateau cake spelling out the words \"FLUX 1 . 1 Pro\", tasty, food photography",
"prompt_upsampling": true,
"safety_tolerance": 2
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_1eF**********************************
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-1.1-pro using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
output_format: "webp",
output_quality: 80,
prompt: "black forest gateau cake spelling out the words \"FLUX 1 . 1 Pro\", tasty, food photography",
prompt_upsampling: true,
safety_tolerance: 2
};
const output = await replicate.run("black-forest-labs/flux-1.1-pro", { input });
// 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_1eF**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-1.1-pro using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"black-forest-labs/flux-1.1-pro",
input={
"aspect_ratio": "1:1",
"output_format": "webp",
"output_quality": 80,
"prompt": "black forest gateau cake spelling out the words \"FLUX 1 . 1 Pro\", tasty, food photography",
"prompt_upsampling": True,
"safety_tolerance": 2
}
)
# 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_1eF**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-1.1-pro 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",
"output_format": "webp",
"output_quality": 80,
"prompt": "black forest gateau cake spelling out the words \\"FLUX 1 . 1 Pro\\", tasty, food photography",
"prompt_upsampling": true,
"safety_tolerance": 2
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-1.1-pro/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "hxvjgf8hmhrge0ckcmdbr6k0km",
"model": "black-forest-labs/flux-1.1-pro",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"output_format": "webp",
"output_quality": 80,
"prompt": "black forest gateau cake spelling out the words \"FLUX 1 . 1 Pro\", tasty, food photography",
"prompt_upsampling": true,
"safety_tolerance": 2
},
"logs": "Running prediction... \nUsing seed: 47744\nGenerating image...\nGenerated image in 3.6sec\nDownloaded image in 0.15sec",
"output": "https://replicate.delivery/czjl/XetPfMnnBtnyLUNiNcnl2Hneyeo8AsfsOl2AG5Znql5f3VK9E/tmpuv7lgrx7.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-25T20:53:47.556Z",
"started_at": "2024-11-25T20:53:47.564701Z",
"completed_at": "2024-11-25T20:53:51.3706Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/hxvjgf8hmhrge0ckcmdbr6k0km/cancel",
"get": "https://api.replicate.com/v1/predictions/hxvjgf8hmhrge0ckcmdbr6k0km",
"stream": "https://stream.replicate.com/v1/files/fddq-rdnmuouasiaorsbl2b5xarywbmuu4222kby6hmoz55vdnnbwtqbq",
"web": "https://replicate.com/p/hxvjgf8hmhrge0ckcmdbr6k0km"
},
"metrics": {
"image_count": 1,
"predict_time": 3.805898917,
"total_time": 3.8146
}
}