typetext
{
"gender": "female",
"mode": "voice_creation",
"pitch": "high",
"prompt_text": "",
"speed": "low",
"temperature": 0.8,
"text": "白日依山尽,黄河入海流。",
"top_k": 50,
"top_p": 0.95
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_4WQ**********************************
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 jichengdu/spark-tts using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"jichengdu/spark-tts:eac056d8a49570ce3e99ed6efe3ce53527b4e3df4abc9c5471dc640dbb75006b",
{
input: {
gender: "female",
mode: "voice_creation",
pitch: "high",
prompt_text: "",
speed: "low",
temperature: 0.8,
text: "白日依山尽,黄河入海流。",
top_k: 50,
top_p: 0.95
}
}
);
// 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_4WQ**********************************
This is your API token. Keep it to yourself.
import replicate
Run jichengdu/spark-tts using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"jichengdu/spark-tts:eac056d8a49570ce3e99ed6efe3ce53527b4e3df4abc9c5471dc640dbb75006b",
input={
"gender": "female",
"mode": "voice_creation",
"pitch": "high",
"prompt_text": "",
"speed": "low",
"temperature": 0.8,
"text": "白日依山尽,黄河入海流。",
"top_k": 50,
"top_p": 0.95
}
)
# 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_4WQ**********************************
This is your API token. Keep it to yourself.
Run jichengdu/spark-tts 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": "jichengdu/spark-tts:eac056d8a49570ce3e99ed6efe3ce53527b4e3df4abc9c5471dc640dbb75006b",
"input": {
"gender": "female",
"mode": "voice_creation",
"pitch": "high",
"prompt_text": "",
"speed": "low",
"temperature": 0.8,
"text": "白日依山尽,黄河入海流。",
"top_k": 50,
"top_p": 0.95
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "nrb36xpsj1rme0cnseatnp4qmw",
"model": "jichengdu/spark-tts",
"version": "eac056d8a49570ce3e99ed6efe3ce53527b4e3df4abc9c5471dc640dbb75006b",
"input": {
"gender": "female",
"mode": "voice_creation",
"pitch": "high",
"prompt_text": "",
"speed": "low",
"temperature": 0.8,
"text": "白日依山尽,黄河入海流。",
"top_k": 50,
"top_p": 0.95
},
"logs": "Running voice creation with text: '白日依山尽,黄河入海流。', gender: 'female', pitch: 'high', speed: 'low'\nSetting `pad_token_id` to `eos_token_id`:None for open-end generation.\nGenerated audio shape: (60800,), min: -0.36268576979637146, max: 0.43774864077568054\nSaved generated audio to generated_speech.wav",
"output": "https://replicate.delivery/xezq/ZmtRBVfNDXWYPCLLVsA8XfQfS5IfSBnVhWnKwq8CfhFjdyfGF/generated_speech.wav",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-03-25T04:35:50.288Z",
"started_at": "2025-03-25T04:36:57.036608Z",
"completed_at": "2025-03-25T04:37:00.603464Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/nrb36xpsj1rme0cnseatnp4qmw/cancel",
"get": "https://api.replicate.com/v1/predictions/nrb36xpsj1rme0cnseatnp4qmw",
"stream": "https://stream.replicate.com/v1/files/bcwr-gnth5inxj7pshj6esk4qwd4a2pd72hl25dclsds75ey26qezvvjq",
"web": "https://replicate.com/p/nrb36xpsj1rme0cnseatnp4qmw"
},
"metrics": {
"predict_time": 3.566855719,
"total_time": 70.315464
}
}