typetext
{
"aspect_ratio": "match_input_image",
"go_fast": true,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/Naxtyn6bEcs5rwPBkbKL9yj9aO4X7j251NpuFg7vI5hvDTsy/-GcCGitGfm6jVI1HsgCfi_118b1a62b53047df8848385f1b459f29.jpg",
"lora_strength": 1,
"lora_weights": "https://huggingface.co/fofr/flux-kontext-dev-ps1-lora/resolve/main/flux-kontext-dev-ps1-lora.safetensors",
"megapixels": "1",
"num_inference_steps": 30,
"output_format": "webp",
"output_quality": 80,
"prompt": "render this image like a ps1 game (no UI)"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_aqF**********************************
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-kontext-dev-lora using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "match_input_image",
go_fast: true,
guidance: 2.5,
input_image: "https://replicate.delivery/pbxt/Naxtyn6bEcs5rwPBkbKL9yj9aO4X7j251NpuFg7vI5hvDTsy/-GcCGitGfm6jVI1HsgCfi_118b1a62b53047df8848385f1b459f29.jpg",
lora_strength: 1,
lora_weights: "https://huggingface.co/fofr/flux-kontext-dev-ps1-lora/resolve/main/flux-kontext-dev-ps1-lora.safetensors",
megapixels: "1",
num_inference_steps: 30,
output_format: "webp",
output_quality: 80,
prompt: "render this image like a ps1 game (no UI)"
};
const output = await replicate.run("black-forest-labs/flux-kontext-dev-lora", { 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_aqF**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-kontext-dev-lora using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"black-forest-labs/flux-kontext-dev-lora",
input={
"aspect_ratio": "match_input_image",
"go_fast": True,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/Naxtyn6bEcs5rwPBkbKL9yj9aO4X7j251NpuFg7vI5hvDTsy/-GcCGitGfm6jVI1HsgCfi_118b1a62b53047df8848385f1b459f29.jpg",
"lora_strength": 1,
"lora_weights": "https://huggingface.co/fofr/flux-kontext-dev-ps1-lora/resolve/main/flux-kontext-dev-ps1-lora.safetensors",
"megapixels": "1",
"num_inference_steps": 30,
"output_format": "webp",
"output_quality": 80,
"prompt": "render this image like a ps1 game (no UI)"
}
)
# 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_aqF**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-kontext-dev-lora 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": "match_input_image",
"go_fast": true,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/Naxtyn6bEcs5rwPBkbKL9yj9aO4X7j251NpuFg7vI5hvDTsy/-GcCGitGfm6jVI1HsgCfi_118b1a62b53047df8848385f1b459f29.jpg",
"lora_strength": 1,
"lora_weights": "https://huggingface.co/fofr/flux-kontext-dev-ps1-lora/resolve/main/flux-kontext-dev-ps1-lora.safetensors",
"megapixels": "1",
"num_inference_steps": 30,
"output_format": "webp",
"output_quality": 80,
"prompt": "render this image like a ps1 game (no UI)"
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-kontext-dev-lora/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "zkp1yndrxxrme0crvz2szs3aem",
"model": "black-forest-labs/flux-kontext-dev-lora",
"version": "hidden",
"input": {
"aspect_ratio": "match_input_image",
"go_fast": true,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/Naxtyn6bEcs5rwPBkbKL9yj9aO4X7j251NpuFg7vI5hvDTsy/-GcCGitGfm6jVI1HsgCfi_118b1a62b53047df8848385f1b459f29.jpg",
"lora_strength": 1,
"lora_weights": "https://huggingface.co/fofr/flux-kontext-dev-ps1-lora/resolve/main/flux-kontext-dev-ps1-lora.safetensors",
"megapixels": "1",
"num_inference_steps": 30,
"output_format": "webp",
"output_quality": 80,
"prompt": "render this image like a ps1 game (no UI)"
},
"logs": "Unloaded 304 layers\nLoRAs unloaded in 0.0033s\nLoading LoRA weights for /src/weights-cache/4698c722db3c7f43\nLoRA weights loaded\nExtracting keys\nKeys extracted\napplying linear1 single_blocks.20.linear1\nlora weight match single_blocks.17.linear2\napplying linear1 single_blocks.32.linear1\napplying attn qkv double_blocks.8.img_attn.qkv\napplying linear1 single_blocks.18.linear1\napplying linear1 single_blocks.29.linear1\nlora weight match single_blocks.36.linear2\nlora weight match single_blocks.9.linear2\nlora weight match single_blocks.19.linear2\nlora weight match double_blocks.15.txt_attn.proj\nlora weight match single_blocks.37.linear2\nlora weight match single_blocks.19.modulation.lin\nlora weight match single_blocks.1.linear2\nlora weight match double_blocks.16.img_mlp.2\nlora weight match double_blocks.3.img_attn.proj\nlora weight match double_blocks.2.txt_attn.proj\nlora weight match single_blocks.21.linear2\napplying attn qkv double_blocks.11.txt_attn.qkv\nlora weight match double_blocks.4.txt_mod.lin\napplying linear1 single_blocks.31.linear1\nlora weight match double_blocks.2.img_mod.lin\nlora weight match double_blocks.0.img_attn.proj\nlora weight match double_blocks.11.img_mlp.0\nlora weight match double_blocks.18.txt_mlp.0\nlora weight match single_blocks.33.modulation.lin\napplying attn qkv double_blocks.16.img_attn.qkv\nlora weight match double_blocks.17.txt_mod.lin\nlora weight match double_blocks.13.img_mlp.2\napplying attn qkv double_blocks.16.txt_attn.qkv\nlora weight match single_blocks.3.linear2\nlora weight match single_blocks.6.modulation.lin\nlora weight match single_blocks.14.modulation.lin\nlora weight match single_blocks.26.linear2\nlora weight match double_blocks.17.img_mod.lin\nlora weight match double_blocks.14.img_mod.lin\nlora weight match single_blocks.2.modulation.lin\napplying linear1 single_blocks.5.linear1\nlora weight match double_blocks.14.txt_mod.lin\nlora weight match single_blocks.18.modulation.lin\napplying attn qkv double_blocks.14.img_attn.qkv\nlora weight match double_blocks.1.img_mod.lin\nlora weight match double_blocks.1.img_mlp.2\nlora weight match single_blocks.5.modulation.lin\nlora weight match single_blocks.27.modulation.lin\napplying linear1 single_blocks.2.linear1\nlora weight match single_blocks.32.modulation.lin\nlora weight match single_blocks.26.modulation.lin\napplying linear1 single_blocks.7.linear1\nlora weight match single_blocks.31.linear2\napplying attn qkv double_blocks.13.img_attn.qkv\napplying linear1 single_blocks.30.linear1\nlora weight match double_blocks.7.txt_mlp.2\nlora weight match double_blocks.12.img_mod.lin\nlora weight match single_blocks.18.linear2\nlora weight match double_blocks.0.txt_attn.proj\nlora weight match double_blocks.13.img_attn.proj\nlora weight match double_blocks.7.img_attn.proj\napplying linear1 single_blocks.24.linear1\nlora weight match double_blocks.9.txt_attn.proj\nlora weight match double_blocks.13.txt_mod.lin\napplying attn qkv double_blocks.17.img_attn.qkv\napplying attn qkv double_blocks.17.txt_attn.qkv\nlora weight match double_blocks.18.txt_attn.proj\nlora weight match single_blocks.31.modulation.lin\nlora weight match double_blocks.9.txt_mod.lin\nlora weight match double_blocks.5.img_mod.lin\nlora weight match double_blocks.2.img_mlp.0\nlora weight match single_blocks.30.modulation.lin\napplying attn qkv double_blocks.0.txt_attn.qkv\nlora weight match double_blocks.5.txt_mlp.0\nlora weight match double_blocks.5.txt_mlp.2\nlora weight match single_blocks.20.linear2\nlora weight match double_blocks.18.img_attn.proj\nlora weight match double_blocks.17.img_mlp.2\napplying attn qkv double_blocks.1.img_attn.qkv\nlora weight match single_blocks.23.modulation.lin\napplying attn qkv double_blocks.18.img_attn.qkv\napplying linear1 single_blocks.33.linear1\napplying attn qkv double_blocks.8.txt_attn.qkv\nlora weight match single_blocks.6.linear2\nlora weight match single_blocks.2.linear2\nlora weight match double_blocks.3.txt_attn.proj\nlora weight match double_blocks.3.img_mod.lin\nlora weight match double_blocks.14.txt_mlp.0\nlora weight match double_blocks.17.img_mlp.0\nlora weight match double_blocks.6.img_attn.proj\nlora weight match double_blocks.10.img_mlp.0\nlora weight match double_blocks.8.txt_mlp.2\nlora weight match double_blocks.5.img_mlp.0\nlora weight match single_blocks.8.linear2\nlora weight match double_blocks.18.txt_mod.lin\nlora weight match single_blocks.13.linear2\nlora weight match single_blocks.21.modulation.lin\nlora weight match double_blocks.1.img_attn.proj\napplying attn qkv double_blocks.13.txt_attn.qkv\nlora weight match single_blocks.32.linear2\nlora weight match single_blocks.23.linear2\napplying linear1 single_blocks.8.linear1\nlora weight match double_blocks.1.txt_attn.proj\nlora weight match double_blocks.2.img_attn.proj\nlora weight match double_blocks.0.img_mod.lin\nlora weight match double_blocks.8.txt_mod.lin\nlora weight match single_blocks.4.modulation.lin\napplying attn qkv double_blocks.9.img_attn.qkv\nlora weight match double_blocks.8.img_attn.proj\nlora weight match double_blocks.6.txt_mlp.2\nlora weight match double_blocks.14.txt_mlp.2\nlora weight match double_blocks.14.img_attn.proj\nlora weight match double_blocks.11.txt_mlp.0\napplying attn qkv double_blocks.5.img_attn.qkv\nlora weight match double_blocks.4.img_mod.lin\nlora weight match double_blocks.9.txt_mlp.2\napplying linear1 single_blocks.25.linear1\nlora weight match double_blocks.12.img_attn.proj\nlora weight match single_blocks.10.modulation.lin\nlora weight match double_blocks.1.txt_mod.lin\napplying attn qkv double_blocks.15.img_attn.qkv\nlora weight match double_blocks.10.img_mlp.2\napplying linear1 single_blocks.3.linear1\nlora weight match double_blocks.18.img_mod.lin\nlora weight match double_blocks.5.img_mlp.2\nlora weight match double_blocks.7.txt_attn.proj\napplying linear1 single_blocks.11.linear1\napplying attn qkv double_blocks.0.img_attn.qkv\nlora weight match single_blocks.0.linear2\nlora weight match single_blocks.15.linear2\nlora weight match single_blocks.16.linear2\nlora weight match double_blocks.6.txt_mod.lin\nlora weight match double_blocks.12.txt_mlp.0\napplying linear1 single_blocks.13.linear1\nlora weight match double_blocks.14.txt_attn.proj\nlora weight match single_blocks.24.linear2\nlora weight match double_blocks.6.img_mod.lin\napplying attn qkv double_blocks.15.txt_attn.qkv\nlora weight match double_blocks.0.img_mlp.0\napplying attn qkv double_blocks.5.txt_attn.qkv\nlora weight match double_blocks.16.txt_attn.proj\nlora weight match double_blocks.1.txt_mlp.2\napplying linear1 single_blocks.36.linear1\nlora weight match double_blocks.0.txt_mod.lin\napplying attn qkv double_blocks.2.img_attn.qkv\nlora weight match double_blocks.6.img_mlp.2\nlora weight match double_blocks.10.img_mod.lin\napplying attn qkv double_blocks.7.img_attn.qkv\nlora weight match double_blocks.12.img_mlp.2\napplying linear1 single_blocks.23.linear1\nlora weight match single_blocks.25.modulation.lin\nlora weight match double_blocks.6.txt_attn.proj\nlora weight match double_blocks.8.txt_attn.proj\nlora weight match double_blocks.11.txt_mlp.2\nlora weight match single_blocks.29.modulation.lin\nlora weight match single_blocks.35.linear2\nlora weight match double_blocks.11.txt_mod.lin\nlora weight match double_blocks.11.img_attn.proj\nlora weight match double_blocks.16.txt_mlp.0\nlora weight match double_blocks.3.txt_mlp.2\napplying linear1 single_blocks.16.linear1\nlora weight match double_blocks.8.txt_mlp.0\nlora weight match single_blocks.13.modulation.lin\nlora weight match single_blocks.8.modulation.lin\nlora weight match double_blocks.5.txt_attn.proj\nlora weight match single_blocks.7.modulation.lin\nlora weight match double_blocks.0.txt_mlp.2\napplying linear1 single_blocks.0.linear1\nlora weight match single_blocks.14.linear2\napplying linear1 single_blocks.37.linear1\nlora weight match single_blocks.36.modulation.lin\nlora weight match double_blocks.4.txt_attn.proj\napplying attn qkv double_blocks.6.txt_attn.qkv\nlora weight match double_blocks.10.txt_attn.proj\nlora weight match single_blocks.28.linear2\nlora weight match double_blocks.3.txt_mlp.0\nlora weight match single_blocks.16.modulation.lin\nlora weight match single_blocks.33.linear2\nlora weight match double_blocks.10.txt_mlp.0\nlora weight match double_blocks.13.img_mlp.0\nlora weight match double_blocks.1.img_mlp.0\napplying attn qkv double_blocks.11.img_attn.qkv\nlora weight match single_blocks.28.modulation.lin\napplying attn qkv double_blocks.1.txt_attn.qkv\nlora weight match single_blocks.1.modulation.lin\napplying linear1 single_blocks.19.linear1\nlora weight match single_blocks.9.modulation.lin\napplying attn qkv double_blocks.7.txt_attn.qkv\nlora weight match double_blocks.17.txt_attn.proj\nlora weight match single_blocks.34.linear2\napplying attn qkv double_blocks.6.img_attn.qkv\napplying linear1 single_blocks.21.linear1\napplying attn qkv double_blocks.10.txt_attn.qkv\nlora weight match double_blocks.3.img_mlp.2\nlora weight match double_blocks.15.txt_mod.lin\nlora weight match double_blocks.15.img_mlp.0\nlora weight match double_blocks.10.txt_mod.lin\nlora weight match single_blocks.12.modulation.lin\nlora weight match single_blocks.37.modulation.lin\napplying attn qkv double_blocks.12.img_attn.qkv\nlora weight match double_blocks.3.txt_mod.lin\napplying attn qkv double_blocks.18.txt_attn.qkv\napplying linear1 single_blocks.27.linear1\nlora weight match double_blocks.18.img_mlp.2\napplying attn qkv double_blocks.12.txt_attn.qkv\napplying attn qkv double_blocks.4.img_attn.qkv\nlora weight match double_blocks.14.img_mlp.0\nlora weight match double_blocks.18.txt_mlp.2\nlora weight match double_blocks.4.txt_mlp.0\nlora weight match double_blocks.0.img_mlp.2\napplying attn qkv double_blocks.4.txt_attn.qkv\nlora weight match double_blocks.1.txt_mlp.0\nlora weight match double_blocks.12.img_mlp.0\nlora weight match double_blocks.5.txt_mod.lin\nlora weight match single_blocks.20.modulation.lin\nlora weight match single_blocks.12.linear2\napplying linear1 single_blocks.17.linear1\napplying linear1 single_blocks.12.linear1\nlora weight match double_blocks.4.img_mlp.2\nlora weight match double_blocks.13.txt_mlp.0\nlora weight match double_blocks.13.txt_attn.proj\napplying attn qkv double_blocks.10.img_attn.qkv\nlora weight match double_blocks.6.img_mlp.0\nlora weight match double_blocks.15.img_mod.lin\nlora weight match single_blocks.17.modulation.lin\nlora weight match double_blocks.11.img_mlp.2\napplying linear1 single_blocks.28.linear1\napplying linear1 single_blocks.6.linear1\napplying attn qkv double_blocks.3.img_attn.qkv\nlora weight match double_blocks.15.txt_mlp.0\nlora weight match single_blocks.0.modulation.lin\napplying linear1 single_blocks.9.linear1\nlora weight match single_blocks.27.linear2\nlora weight match single_blocks.10.linear2\nlora weight match single_blocks.34.modulation.lin\nlora weight match double_blocks.9.img_mod.lin\nlora weight match double_blocks.4.img_attn.proj\nlora weight match double_blocks.13.txt_mlp.2\napplying linear1 single_blocks.4.linear1\nlora weight match double_blocks.16.img_attn.proj\napplying linear1 single_blocks.15.linear1\nlora weight match double_blocks.2.txt_mlp.0\nlora weight match single_blocks.22.modulation.lin\nlora weight match double_blocks.17.img_attn.proj\nlora weight match single_blocks.5.linear2\napplying linear1 single_blocks.35.linear1\nlora weight match double_blocks.15.txt_mlp.2\nlora weight match single_blocks.4.linear2\nlora weight match double_blocks.4.txt_mlp.2\nlora weight match double_blocks.18.img_mlp.0\nlora weight match double_blocks.17.txt_mlp.2\nlora weight match double_blocks.7.img_mlp.2\nlora weight match double_blocks.13.img_mod.lin\nlora weight match double_blocks.16.img_mlp.0\nlora weight match double_blocks.8.img_mlp.2\nlora weight match single_blocks.29.linear2\nlora weight match double_blocks.0.txt_mlp.0\nlora weight match double_blocks.7.img_mlp.0\nlora weight match double_blocks.10.img_attn.proj\nlora weight match double_blocks.17.txt_mlp.0\nlora weight match single_blocks.7.linear2\nlora weight match double_blocks.9.img_attn.proj\napplying attn qkv double_blocks.2.txt_attn.qkv\nlora weight match double_blocks.15.img_mlp.2\nlora weight match double_blocks.10.txt_mlp.2\napplying linear1 single_blocks.34.linear1\nlora weight match double_blocks.9.txt_mlp.0\nlora weight match double_blocks.5.img_attn.proj\nlora weight match double_blocks.11.txt_attn.proj\nlora weight match double_blocks.4.img_mlp.0\nlora weight match double_blocks.3.img_mlp.0\nlora weight match double_blocks.8.img_mlp.0\nlora weight match double_blocks.7.txt_mod.lin\nlora weight match double_blocks.7.txt_mlp.0\nlora weight match single_blocks.11.linear2\nlora weight match double_blocks.16.img_mod.lin\nlora weight match double_blocks.12.txt_attn.proj\nlora weight match single_blocks.25.linear2\napplying attn qkv double_blocks.14.txt_attn.qkv\napplying linear1 single_blocks.26.linear1\nlora weight match double_blocks.7.img_mod.lin\nlora weight match double_blocks.9.img_mlp.2\nlora weight match double_blocks.8.img_mod.lin\nlora weight match double_blocks.2.txt_mod.lin\nlora weight match double_blocks.12.txt_mlp.2\nlora weight match single_blocks.11.modulation.lin\nlora weight match single_blocks.15.modulation.lin\napplying linear1 single_blocks.10.linear1\napplying attn qkv double_blocks.9.txt_attn.qkv\nlora weight match double_blocks.15.img_attn.proj\nlora weight match single_blocks.22.linear2\napplying linear1 single_blocks.22.linear1\napplying linear1 single_blocks.1.linear1\nlora weight match double_blocks.11.img_mod.lin\napplying linear1 single_blocks.14.linear1\nlora weight match double_blocks.16.txt_mod.lin\nlora weight match single_blocks.24.modulation.lin\nlora weight match double_blocks.2.img_mlp.2\napplying attn qkv double_blocks.3.txt_attn.qkv\nlora weight match double_blocks.6.txt_mlp.0\nlora weight match double_blocks.9.img_mlp.0\nlora weight match single_blocks.30.linear2\nlora weight match double_blocks.12.txt_mod.lin\nlora weight match single_blocks.35.modulation.lin\nlora weight match double_blocks.14.img_mlp.2\nlora weight match double_blocks.2.txt_mlp.2\nlora weight match double_blocks.16.txt_mlp.2\nlora weight match single_blocks.3.modulation.lin\nApplying LoRA: 0%| | 0/304 [00:00<?, ?it/s]\nApplying LoRA: 100%|██████████| 304/304 [00:00<00:00, 3479.73it/s]\nLoading LoRA in bf16\nLoRA applied in 0.16s\nUsing seed: 61940\nRunning in image-to-image mode\nTarget dimensions: NonexNone\nTotal safe images: 1 out of 1",
"output": "https://replicate.delivery/xezq/zN3a60uxYObHBBZuAK0AmdlI5rkqpGR839foFjvOK3BlWNnKA/output.webp",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-25T05:48:53.871Z",
"started_at": "2025-08-25T05:48:53.877892Z",
"completed_at": "2025-08-25T05:48:58.592696Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/zkp1yndrxxrme0crvz2szs3aem/cancel",
"get": "https://api.replicate.com/v1/predictions/zkp1yndrxxrme0crvz2szs3aem",
"stream": "https://stream.replicate.com/v1/files/bcwr-2u2igjexizrwtfdv7cucvkcz7ifcignvpk3pl4wjqptazskhgvfq",
"web": "https://replicate.com/p/zkp1yndrxxrme0crvz2szs3aem"
},
"metrics": {
"predict_time": 4.714804389,
"total_time": 4.721696
}
}
