typetext
{
"aspect_ratio": "4:5",
"prompt": "High-end product photography of a luxury perfume bottle on a polished black marble surface. The bottle is frosted glass with gold accents. Soft directional studio lighting with a single reflection streak. Minimal, premium, editorial beauty photography."
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_dD0**********************************
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 recraft-ai/recraft-v4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "4:5",
prompt: "High-end product photography of a luxury perfume bottle on a polished black marble surface. The bottle is frosted glass with gold accents. Soft directional studio lighting with a single reflection streak. Minimal, premium, editorial beauty photography."
};
const output = await replicate.run("recraft-ai/recraft-v4", { 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_dD0**********************************
This is your API token. Keep it to yourself.
import replicate
Run recraft-ai/recraft-v4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"recraft-ai/recraft-v4",
input={
"aspect_ratio": "4:5",
"prompt": "High-end product photography of a luxury perfume bottle on a polished black marble surface. The bottle is frosted glass with gold accents. Soft directional studio lighting with a single reflection streak. Minimal, premium, editorial beauty photography."
}
)
# 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_dD0**********************************
This is your API token. Keep it to yourself.
Run recraft-ai/recraft-v4 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": "4:5",
"prompt": "High-end product photography of a luxury perfume bottle on a polished black marble surface. The bottle is frosted glass with gold accents. Soft directional studio lighting with a single reflection streak. Minimal, premium, editorial beauty photography."
}
}' \
https://api.replicate.com/v1/models/recraft-ai/recraft-v4/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "traz3nhz0nrmy0cwe6vs4kbr1c",
"model": "recraft-ai/recraft-v4",
"version": "hidden",
"input": {
"aspect_ratio": "4:5",
"prompt": "High-end product photography of a luxury perfume bottle on a polished black marble surface. The bottle is frosted glass with gold accents. Soft directional studio lighting with a single reflection streak. Minimal, premium, editorial beauty photography."
},
"logs": "Moderating content...\nWarning: Moderation check failed\nStarting image generation...\nGenerated image in 11.35sec\nDownloading 1063566 bytes\nDownloaded 1.01MB in 0.11sec",
"output": "https://replicate.delivery/xezq/PtAaGYBUcNbtBdSnwuWu2H3ep49j77pHOgBfUt4NQktEO6IWA/tmppkr26oz1.webp",
"data_removed": false,
"error": null,
"source": "api",
"status": "succeeded",
"created_at": "2026-02-18T17:06:00.581Z",
"started_at": "2026-02-18T17:06:00.59037Z",
"completed_at": "2026-02-18T17:06:12.378042Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/traz3nhz0nrmy0cwe6vs4kbr1c/cancel",
"get": "https://api.replicate.com/v1/predictions/traz3nhz0nrmy0cwe6vs4kbr1c",
"stream": "https://stream.replicate.com/v1/files/jbxs-nlyllysis6njuve6ifritpmronxps5qp2mxabckifxntioafvmwq",
"web": "https://replicate.com/p/traz3nhz0nrmy0cwe6vs4kbr1c"
},
"metrics": {
"predict_time": 11.787671237,
"total_time": 11.797042178
}
}