curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'model="chatterbox-nano"' \
--form 'input="Testing model to generate voice. Hey how are you today?"' \
--form 'response_format="mp3"' \
--form 'seed="1234"' \
--form 'voice_sample=@"/path/to/file"' \
--output speech.mp3
curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "chatterbox-nano",
"input": "Hello from herogpu.",
"voice": "alloy",
"response_format": "mp3"
}' \
--output speech.mp3
from openai import OpenAI
client = OpenAI(
base_url="https://api.herogpu.com/v1",
api_key="YOUR_API_KEY", # sent as Authorization: Bearer
)
with client.audio.speech.with_streaming_response.create(
model="chatterbox-nano",
voice="alloy", # OpenAI voice names map to the built-in voice
input="Hello from herogpu.",
response_format="mp3",
) as response:
response.stream_to_file("speech.mp3")
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.herogpu.com/v1",
apiKey: "YOUR_API_KEY", // sent as Authorization: Bearer
});
const speech = await client.audio.speech.create({
model: "chatterbox-nano",
voice: "alloy", // OpenAI voice names map to the built-in voice
input: "Hello from herogpu.",
response_format: "mp3",
});
fs.writeFileSync("speech.mp3", Buffer.from(await speech.arrayBuffer()));
HTTP/2 200
content-type: audio/mpeg
x-audio-duration-seconds: 1.76
<binary MP3 audio>
Audio Models
Speech
Generate speech from text with chatterbox-nano or chatterbox, with optional voice cloning from a reference clip.
POST
/
audio
/
speech
curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'model="chatterbox-nano"' \
--form 'input="Testing model to generate voice. Hey how are you today?"' \
--form 'response_format="mp3"' \
--form 'seed="1234"' \
--form 'voice_sample=@"/path/to/file"' \
--output speech.mp3
curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "chatterbox-nano",
"input": "Hello from herogpu.",
"voice": "alloy",
"response_format": "mp3"
}' \
--output speech.mp3
from openai import OpenAI
client = OpenAI(
base_url="https://api.herogpu.com/v1",
api_key="YOUR_API_KEY", # sent as Authorization: Bearer
)
with client.audio.speech.with_streaming_response.create(
model="chatterbox-nano",
voice="alloy", # OpenAI voice names map to the built-in voice
input="Hello from herogpu.",
response_format="mp3",
) as response:
response.stream_to_file("speech.mp3")
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.herogpu.com/v1",
apiKey: "YOUR_API_KEY", // sent as Authorization: Bearer
});
const speech = await client.audio.speech.create({
model: "chatterbox-nano",
voice: "alloy", // OpenAI voice names map to the built-in voice
input: "Hello from herogpu.",
response_format: "mp3",
});
fs.writeFileSync("speech.mp3", Buffer.from(await speech.arrayBuffer()));
HTTP/2 200
content-type: audio/mpeg
x-audio-duration-seconds: 1.76
<binary MP3 audio>
Limits
| Limit | Value |
|---|---|
input length | 2,000 characters, English only. Requests near the limit can time out with 524. |
voice_sample duration | 6 to 30 seconds |
voice_sample size | 10 MB |
voice_sample formats | mp3, m4a, wav, flac, ogg, webm, mp4 |
| Unsupported parameters | instructions, exaggeration, cfg_weight, min_p, and speed other than 1.0 return 400 |
curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'model="chatterbox-nano"' \
--form 'input="Testing model to generate voice. Hey how are you today?"' \
--form 'response_format="mp3"' \
--form 'seed="1234"' \
--form 'voice_sample=@"/path/to/file"' \
--output speech.mp3
curl --location 'https://api.herogpu.com/v1/audio/speech' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "chatterbox-nano",
"input": "Hello from herogpu.",
"voice": "alloy",
"response_format": "mp3"
}' \
--output speech.mp3
from openai import OpenAI
client = OpenAI(
base_url="https://api.herogpu.com/v1",
api_key="YOUR_API_KEY", # sent as Authorization: Bearer
)
with client.audio.speech.with_streaming_response.create(
model="chatterbox-nano",
voice="alloy", # OpenAI voice names map to the built-in voice
input="Hello from herogpu.",
response_format="mp3",
) as response:
response.stream_to_file("speech.mp3")
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.herogpu.com/v1",
apiKey: "YOUR_API_KEY", // sent as Authorization: Bearer
});
const speech = await client.audio.speech.create({
model: "chatterbox-nano",
voice: "alloy", // OpenAI voice names map to the built-in voice
input: "Hello from herogpu.",
response_format: "mp3",
});
fs.writeFileSync("speech.mp3", Buffer.from(await speech.arrayBuffer()));
HTTP/2 200
content-type: audio/mpeg
x-audio-duration-seconds: 1.76
<binary MP3 audio>
Authorizations
ApiKeyBearerAuth
Body
multipart/form-dataapplication/json
Multipart form, required for voice cloning.
Response
The audio file, with a content type matching response_format.
The response is of type file.

