typetext
{
"aspect_ratio": "3:4",
"number_of_images": 1,
"prompt": "A close-up portrait of a leopard with distinctive spotted pattern and intense eyes",
"prompt_optimizer": true
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_NUi**********************************
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 minimax/image-01 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "3:4",
number_of_images: 1,
prompt: "A close-up portrait of a leopard with distinctive spotted pattern and intense eyes",
prompt_optimizer: true
};
const output = await replicate.run("minimax/image-01", { 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_NUi**********************************
This is your API token. Keep it to yourself.
import replicate
Run minimax/image-01 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"minimax/image-01",
input={
"aspect_ratio": "3:4",
"number_of_images": 1,
"prompt": "A close-up portrait of a leopard with distinctive spotted pattern and intense eyes",
"prompt_optimizer": True
}
)
# 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_NUi**********************************
This is your API token. Keep it to yourself.
Run minimax/image-01 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:4",
"number_of_images": 1,
"prompt": "A close-up portrait of a leopard with distinctive spotted pattern and intense eyes",
"prompt_optimizer": true
}
}' \
https://api.replicate.com/v1/models/minimax/image-01/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "w4agaakfhnrme0cnbhgtyfmstc",
"model": "minimax/image-01",
"version": "hidden",
"input": {
"aspect_ratio": "3:4",
"number_of_images": 1,
"prompt": "A close-up portrait of a leopard with distinctive spotted pattern and intense eyes",
"prompt_optimizer": true
},
"logs": "Moderating content...\nModeration complete in 0.23sec\nRunning prediction...\nDownloading 412876 bytes\nDownloaded 0.39MB in 0.12sec\nGenerated 1 image",
"output": [
"https://replicate.delivery/xezq/DIW1tQHSNXY2Lhlk22V8fQsEqx5sDfqilWuNbciQTmf1mtpoA/tmpf6p003az.jpeg"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-03-03T14:20:44.301Z",
"started_at": "2025-03-03T14:20:44.334545Z",
"completed_at": "2025-03-03T14:21:14.828367Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/w4agaakfhnrme0cnbhgtyfmstc/cancel",
"get": "https://api.replicate.com/v1/predictions/w4agaakfhnrme0cnbhgtyfmstc",
"stream": "https://stream.replicate.com/v1/files/bcwr-ustoljd7enrpatb34fxhhkru5cvfteijmzs3ggu7atqz6cx2hoja",
"web": "https://replicate.com/p/w4agaakfhnrme0cnbhgtyfmstc"
},
"metrics": {
"image_count": 1,
"predict_time": 30.493822198,
"total_time": 30.527367
}
}