typetext
{
"letter": "A"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LrH**********************************
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 pipeline-examples/draw-letter using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
letter: "A"
};
const output = await replicate.run("pipeline-examples/draw-letter", { 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_LrH**********************************
This is your API token. Keep it to yourself.
import replicate
Run pipeline-examples/draw-letter using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"pipeline-examples/draw-letter",
input={
"letter": "A"
}
)
# 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_LrH**********************************
This is your API token. Keep it to yourself.
Run pipeline-examples/draw-letter 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": {
"letter": "A"
}
}' \
https://api.replicate.com/v1/models/pipeline-examples/draw-letter/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "r9jdbtv0kdrmc0crq518zvm1hc",
"model": "pipeline-examples/draw-letter",
"version": "hidden",
"input": {
"letter": "A"
},
"logs": "",
"output": "https://replicate.delivery/xezq/XSK81HoTeg36BKYjXn5cngj8r9di1cpvKg6evklk0jfQ65XqA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-08-17T18:19:51.835Z",
"started_at": "2025-08-17T18:19:52.105325Z",
"completed_at": "2025-08-17T18:19:52.268883Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/r9jdbtv0kdrmc0crq518zvm1hc/cancel",
"children": "https://api.replicate.com/v1/predictions/r9jdbtv0kdrmc0crq518zvm1hc/children",
"get": "https://api.replicate.com/v1/predictions/r9jdbtv0kdrmc0crq518zvm1hc",
"root": "https://api.replicate.com/v1/predictions/r9jdbtv0kdrmc0crq518zvm1hc",
"stream": "https://stream.replicate.com/v1/files/bcwr-25gh2zi34xvg5mqodgpu62wb2rxc4oyvtzhkidhujxqlbz5r7uja",
"web": "https://replicate.com/p/r9jdbtv0kdrmc0crq518zvm1hc"
},
"metrics": {
"predict_time": 0.163557691,
"total_time": 0.433883
}
}