typetext
{
"aspect_ratio": "16:9",
"enhance_prompt": false,
"go_fast": true,
"guidance": 4,
"image_size": "optimize_for_quality",
"lora_scale": 1,
"negative_prompt": " ",
"num_inference_steps": 50,
"output_format": "webp",
"output_quality": 80,
"prompt": "cute dog with a funny hat",
"strength": 0.9
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bni**********************************
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 qwen/qwen-image using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "16:9",
enhance_prompt: false,
go_fast: true,
guidance: 4,
image_size: "optimize_for_quality",
lora_scale: 1,
negative_prompt: " ",
num_inference_steps: 50,
output_format: "webp",
output_quality: 80,
prompt: "cute dog with a funny hat",
strength: 0.9
};
const output = await replicate.run("qwen/qwen-image", { 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_Bni**********************************
This is your API token. Keep it to yourself.
import replicate
Run qwen/qwen-image using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"qwen/qwen-image",
input={
"aspect_ratio": "16:9",
"enhance_prompt": False,
"go_fast": True,
"guidance": 4,
"image_size": "optimize_for_quality",
"lora_scale": 1,
"negative_prompt": " ",
"num_inference_steps": 50,
"output_format": "webp",
"output_quality": 80,
"prompt": "cute dog with a funny hat",
"strength": 0.9
}
)
# 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_Bni**********************************
This is your API token. Keep it to yourself.
Run qwen/qwen-image 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",
"enhance_prompt": false,
"go_fast": true,
"guidance": 4,
"image_size": "optimize_for_quality",
"lora_scale": 1,
"negative_prompt": " ",
"num_inference_steps": 50,
"output_format": "webp",
"output_quality": 80,
"prompt": "cute dog with a funny hat",
"strength": 0.9
}
}' \
https://api.replicate.com/v1/models/qwen/qwen-image/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "wzzhb6fdsdrmc0csdj39nem8hg",
"model": "qwen/qwen-image",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"enhance_prompt": false,
"go_fast": true,
"guidance": 4,
"image_size": "optimize_for_quality",
"lora_scale": 1,
"negative_prompt": " ",
"num_inference_steps": 50,
"output_format": "webp",
"output_quality": 80,
"prompt": "cute dog with a funny hat",
"strength": 0.9
},
"logs": "Using seed: 36343\nGeneration took 3.02 seconds\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/xezq/IlV5GMzis46WMBfIPABq8REznOx8fUlyXHBiKS9DwFzJPbXVA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-09-21T13:46:46.091Z",
"started_at": "2025-09-21T13:46:46.098221Z",
"completed_at": "2025-09-21T13:46:49.232827Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/wzzhb6fdsdrmc0csdj39nem8hg/cancel",
"get": "https://api.replicate.com/v1/predictions/wzzhb6fdsdrmc0csdj39nem8hg",
"stream": "https://stream.replicate.com/v1/files/bcwr-br2ue2sax33ww6vzu45eqlvezmmsloxkxr2aonzyf6cn3fgyc6xq",
"web": "https://replicate.com/p/wzzhb6fdsdrmc0csdj39nem8hg"
},
"metrics": {
"predict_time": 3.134605393,
"total_time": 3.141827
}
}