typetext
{
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "chrome sports car by the sea",
"style_reference_weight": 0.85
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_bD4**********************************
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 luma/photon using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "16:9",
image_reference_weight: 0.85,
prompt: "chrome sports car by the sea",
style_reference_weight: 0.85
};
const output = await replicate.run("luma/photon", { 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_bD4**********************************
This is your API token. Keep it to yourself.
import replicate
Run luma/photon using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"luma/photon",
input={
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "chrome sports car by the sea",
"style_reference_weight": 0.85
}
)
# 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_bD4**********************************
This is your API token. Keep it to yourself.
Run luma/photon 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": "16:9",
"image_reference_weight": 0.85,
"prompt": "chrome sports car by the sea",
"style_reference_weight": 0.85
}
}' \
https://api.replicate.com/v1/models/luma/photon/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "b099xz7k8drge0cmchs91wpm8w",
"model": "luma/photon",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"image_reference_weight": 0.85,
"prompt": "chrome sports car by the sea",
"style_reference_weight": 0.85
},
"logs": "Using seed: 1676474656\nRunning prediction... \nGenerating image...\nModerating content...\nModeration complete in 0.23sec\nDreaming...\nCompleted...\nGenerated image in 11.00sec\nDownloading 1567900 bytes\nDownloaded 1.50MB in 0.25sec",
"output": "https://replicate.delivery/czjl/bN35SK7p4yqNAxfG9Tgak5YuyfvTcGiAbqPltpbKEc0VRfJoA/tmp95lh8mhu.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-01-14T10:54:02.563Z",
"started_at": "2025-01-14T10:54:02.570435Z",
"completed_at": "2025-01-14T10:54:13.860974Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/b099xz7k8drge0cmchs91wpm8w/cancel",
"get": "https://api.replicate.com/v1/predictions/b099xz7k8drge0cmchs91wpm8w",
"stream": "https://stream.replicate.com/v1/files/fddq-dtgfun7flkg4v2xnr4sfndxfvnjjxopcytefcpg5laubmigqycia",
"web": "https://replicate.com/p/b099xz7k8drge0cmchs91wpm8w"
},
"metrics": {
"image_count": 1,
"predict_time": 11.290539499,
"total_time": 11.297974
}
}