defaultan astronaut riding a horse on the moon
typetext
{
"guidance_scale": 3.5,
"height": 1024,
"num_inference_steps": 28,
"prompt": "an astronaut riding a horse on the moon",
"width": 1024
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Y9g**********************************
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 ostris/flex.1-alpha using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"ostris/flex.1-alpha:de4ca9378f548d98674c5922a2a0e6dd09b412045653895ae310f74a5a5ce927",
{
input: {
guidance_scale: 3.5,
height: 1024,
num_inference_steps: 28,
prompt: "an astronaut riding a horse on the moon",
width: 1024
}
}
);
// 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_Y9g**********************************
This is your API token. Keep it to yourself.
import replicate
Run ostris/flex.1-alpha using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"ostris/flex.1-alpha:de4ca9378f548d98674c5922a2a0e6dd09b412045653895ae310f74a5a5ce927",
input={
"guidance_scale": 3.5,
"height": 1024,
"num_inference_steps": 28,
"prompt": "an astronaut riding a horse on the moon",
"width": 1024
}
)
# 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_Y9g**********************************
This is your API token. Keep it to yourself.
Run ostris/flex.1-alpha 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 $'{
"version": "ostris/flex.1-alpha:de4ca9378f548d98674c5922a2a0e6dd09b412045653895ae310f74a5a5ce927",
"input": {
"guidance_scale": 3.5,
"height": 1024,
"num_inference_steps": 28,
"prompt": "an astronaut riding a horse on the moon",
"width": 1024
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "fbs818yd6srme0cn02j9vqwm7r",
"model": "ostris/flex.1-alpha",
"version": "de4ca9378f548d98674c5922a2a0e6dd09b412045653895ae310f74a5a5ce927",
"input": {
"guidance_scale": 3.5,
"height": 1024,
"num_inference_steps": 28,
"prompt": "an astronaut riding a horse on the moon",
"width": 1024
},
"logs": "Using seed: 36632",
"output": "https://replicate.delivery/xezq/X4DClFP6lJpZONd3JhXlxvKp8tfsg95ZeLuls7LGMwckDfdoA/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-02-13T18:49:15.318Z",
"started_at": "2025-02-13T18:49:57.127801Z",
"completed_at": "2025-02-13T18:50:12.760384Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/fbs818yd6srme0cn02j9vqwm7r/cancel",
"get": "https://api.replicate.com/v1/predictions/fbs818yd6srme0cn02j9vqwm7r",
"stream": "https://stream.replicate.com/v1/files/bcwr-pzvcl3c7cg2idysr32vx3s3jnyzz2vmxfpa3cqdhgam4vog6eahq",
"web": "https://replicate.com/p/fbs818yd6srme0cn02j9vqwm7r"
},
"metrics": {
"predict_time": 15.632583712,
"total_time": 57.442384
}
}