typetext
{
"aspect_ratio": "3:2",
"output_format": "jpg",
"prompt": "A gamer room in need of serious tidying up",
"raw": true,
"safety_tolerance": 2
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_SVA**********************************
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-ultra using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "3:2",
output_format: "jpg",
prompt: "A gamer room in need of serious tidying up",
raw: true,
safety_tolerance: 2
};
const output = await replicate.run("black-forest-labs/flux-1.1-pro-ultra", { 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_SVA**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-1.1-pro-ultra 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-ultra",
input={
"aspect_ratio": "3:2",
"output_format": "jpg",
"prompt": "A gamer room in need of serious tidying up",
"raw": 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_SVA**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-1.1-pro-ultra 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": "3:2",
"output_format": "jpg",
"prompt": "A gamer room in need of serious tidying up",
"raw": true,
"safety_tolerance": 2
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-1.1-pro-ultra/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "y9165eeaa5rg80ck0z7v0masm4",
"model": "black-forest-labs/flux-1.1-pro-ultra",
"version": "hidden",
"input": {
"aspect_ratio": "3:2",
"output_format": "jpg",
"prompt": "A gamer room in need of serious tidying up",
"raw": true,
"safety_tolerance": 2
},
"logs": "Using seed: 55713\nRunning prediction... \nGenerating image...\nGenerated image in 10.3sec",
"output": "https://replicate.delivery/czjl/QAuLBV60ppr3Bt5kyMzluiUF89llbQGcXDSJLiuTLxYC0q7E/output.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-07T18:07:58.545Z",
"started_at": "2024-11-07T18:07:58.552807Z",
"completed_at": "2024-11-07T18:08:10.81912Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/y9165eeaa5rg80ck0z7v0masm4/cancel",
"get": "https://api.replicate.com/v1/predictions/y9165eeaa5rg80ck0z7v0masm4",
"stream": "https://stream.replicate.com/v1/files/fddq-6dwp4stnere43xqh2op3ir2dfkxall6hogmdkpsuc4y4t4locfna",
"web": "https://replicate.com/p/y9165eeaa5rg80ck0z7v0masm4"
},
"metrics": {
"image_count": 1,
"predict_time": 12.266312484,
"total_time": 12.27412
}
}