black-forest-labs
/
flux-depth-dev
Open-weight depth-aware image generation. Edit images while preserving spatial relationships.
Run replicate/flux-depth-dev-internal-model with an API
Use one of our client libraries to get started quickly.
Set the REPLICATE_API_TOKEN
environment variable
export REPLICATE_API_TOKEN=<paste-your-token-here>
Learn more about authentication
Install Replicate’s Node.js client library
npm install replicate
Run black-forest-labs/flux-depth-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
import Replicate from "replicate";
const replicate = new Replicate();
const input = {
prompt: "A tropical beach",
control_image: "https://replicate.delivery/pbxt/M0mJ4lphqO0HOGDb7jwYb4nMjmn0fh3joS0PxeQ90TPN0Skb/IMG_2270.jpg"
};
const output = await replicate.run("black-forest-labs/flux-depth-dev", { input });
import { writeFile } from "node:fs/promises";
for (const [index, item] of Object.entries(output)) {
await writeFile(`output_${index}.webp`, item);
}
//=> output_0.webp written to disk