typetext
{
"aspect_ratio": "3:2",
"fallback_aspect_ratio": true,
"model": "recraft-ai/recraft-v3",
"num_outputs": 3,
"prompt": "a photo of a dog"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_QDI**********************************
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 fofr/image-models using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "3:2",
fallback_aspect_ratio: true,
model: "recraft-ai/recraft-v3",
num_outputs: 3,
prompt: "a photo of a dog"
};
const output = await replicate.run("fofr/image-models", { 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_QDI**********************************
This is your API token. Keep it to yourself.
import replicate
Run fofr/image-models using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"fofr/image-models",
input={
"aspect_ratio": "3:2",
"fallback_aspect_ratio": True,
"model": "recraft-ai/recraft-v3",
"num_outputs": 3,
"prompt": "a photo of a dog"
}
)
# 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_QDI**********************************
This is your API token. Keep it to yourself.
Run fofr/image-models 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",
"fallback_aspect_ratio": true,
"model": "recraft-ai/recraft-v3",
"num_outputs": 3,
"prompt": "a photo of a dog"
}
}' \
https://api.replicate.com/v1/models/fofr/image-models/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "br82sang9hrmc0crryd9wc0azc",
"model": "fofr/image-models",
"version": "hidden",
"input": {
"aspect_ratio": "3:2",
"fallback_aspect_ratio": true,
"model": "recraft-ai/recraft-v3",
"num_outputs": 3,
"prompt": "a photo of a dog"
},
"logs": "",
"output": [
"https://replicate.delivery/xezq/lIUUVnT1kKLlFRYASLkQosD4UFbvuJO0ES0kWsfa4sj22bmKA/tmpqoyia78o.webp",
"https://replicate.delivery/xezq/F3EyrtV62uK7M5nM5YWsJSp2GjBfpWGKE6XUtXYJNUl22bmKA/tmp16hzsd9u.webp",
"https://replicate.delivery/xezq/bDrLdiMYXyLfUKaTB9EcPahJ4EtjCSfpHXDeo9DeA6est9mpC/tmph9advne7.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-20T13:11:00.428Z",
"started_at": "2025-08-20T13:11:00.739765Z",
"completed_at": "2025-08-20T13:11:09.71493Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/br82sang9hrmc0crryd9wc0azc/cancel",
"children": "https://api.replicate.com/v1/predictions/br82sang9hrmc0crryd9wc0azc/children",
"get": "https://api.replicate.com/v1/predictions/br82sang9hrmc0crryd9wc0azc",
"root": "https://api.replicate.com/v1/predictions/br82sang9hrmc0crryd9wc0azc",
"stream": "https://stream.replicate.com/v1/files/bcwr-xy2khjfi62zj2ir5nwnd6lhhnmfxi73kjc2d7ynwtevuizk4lbfq",
"web": "https://replicate.com/p/br82sang9hrmc0crryd9wc0azc"
},
"metrics": {
"predict_time": 8.975165178,
"total_time": 9.28693
}
}

