Voice design
Pricing: Voice design
Text in, speech out, in a voice you describe in plain words ("a calm, weathered old sailor with a low, gravelly voice"). No reference recording is needed: the voice is designed from the description. One mp3 comes back (320 kb/s, 24 kHz mono). The model is MOSS-TTS VoiceGenerator; Chinese, English, Japanese and Korean text are recognised automatically.
POST https://api.happypony.io/api/v1/jobs/voice-design
GET https://api.happypony.io/api/v1/jobs/:requestId/status
GET https://api.happypony.io/api/v1/jobs/:requestId
PUT https://api.happypony.io/api/v1/jobs/:requestId/cancel
1) Create a request
POST https://api.happypony.io/api/v1/jobs/voice-design with Content-Type: application/json.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text |
string | yes, unless image_url is given |
with image_url: a short line written for the character |
The words to speak, read exactly as written (no rewriting). Up to 2000 characters, about 2.5 minutes of speech. |
voice_description |
string | no | the model's default voice | How the voice should sound: gender, age, timbre, pace, emotion, accent. Up to 1000 characters. With image_url, this is an extra requirement combined with the picture. |
batch_size |
integer | no | 3 |
How many takes to render, 1 to 8. |
image_url |
string | no | A public http(s) URL of a picture of the character. A vision model works out how the main character should sound and writes the voice description, usually adding up to about 30 seconds to the create call. |
|
seed |
integer | no | random | 0 to 4294967295. The same text, description and seed give the same take; change it for another take. |
Neither the text, the description nor the picture goes through the image/video content check, so voice design never answers 422 content_rejected. If the vision model cannot describe the picture, the create call answers 502 and nothing is charged.
To design the voice from a picture, send image_url instead of (or along with) voice_description. The parameters on the status and result responses then show the generated text and voice_description, plus image_url and your voice_requirements:
{
"image_url": "https://example.com/old-sailor.png",
"voice_description": "He has a faint Irish accent"
}
Request body:
{
"text": "Welcome aboard. Mind the gap between the dock and the deck.",
"voice_description": "A calm, weathered old sailor with a low, gravelly voice and a slow pace",
"seed": 42
}
curl -X POST https://api.happypony.io/api/v1/jobs/voice-design \
-H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
-d '{"text": "Welcome aboard. Mind the gap between the dock and the deck.", "voice_description": "A calm, weathered old sailor with a low, gravelly voice"}'
Response 202 (fields: Create response):
{
"request_id": "48410",
"type": "voice-design",
"status": "IN_QUEUE",
"credits": 2,
"status_url": "https://api.happypony.io/api/v1/jobs/48410/status",
"response_url": "https://api.happypony.io/api/v1/jobs/48410",
"cancel_url": "https://api.happypony.io/api/v1/jobs/48410/cancel"
}
2) Poll for status
Poll the status_url until status is COMPLETED, FAILED or CANCELLED (fields: Status response). A short line usually finishes within half a minute of leaving the queue. A queued job can be cancelled with PUT on the cancel_url (Cancel a request).
curl https://api.happypony.io/api/v1/jobs/48410/status -H "Authorization: Bearer $HP_KEY"
{
"request_id": "48410",
"type": "voice-design",
"status": "IN_PROGRESS",
"created_at": "2026-11-04T10:00:00.000Z",
"completed_at": null,
"credits": 2,
"status_url": "…", "response_url": "…", "cancel_url": "…"
}
3) Fetch the result
When status is COMPLETED, fetch the response_url (common fields: Result response). The speech is under audio, not images:
curl https://api.happypony.io/api/v1/jobs/48410 -H "Authorization: Bearer $HP_KEY"
{
"request_id": "48410",
"type": "voice-design",
"status": "COMPLETED",
"created_at": "2026-11-04T10:00:00.000Z",
"completed_at": "2026-11-04T10:00:21.000Z",
"credits": 2,
"audio": [{ "url": "https://…signed…", "format": "mp3" }],
"expires_in": 259200,
"parameters": { "text": "Welcome aboard. Mind the gap between the dock and the deck.",
"voice_description": "A calm, weathered old sailor with a low, gravelly voice and a slow pace",
"seed": 42 },
"status_url": "…", "response_url": "…", "cancel_url": "…"
}
| Field | Type | Description |
|---|---|---|
audio |
object[] | One { "url", "format" } (mp3); empty until COMPLETED. |
parameters |
object | text, voice_description (null for the default voice) and seed (null when it was random). With a picture, also image_url and voice_requirements; text and voice_description are what was rendered. |
Full example
Create, poll until done, download:
curl (bash)
# Needs curl and jq. Usage: HP_KEY=hp_… ./voice.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/voice-design \
-H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
-d '{"text": "Welcome aboard. Mind the gap between the dock and the deck.",
"voice_description": "A calm, weathered old sailor with a low, gravelly voice and a slow pace"}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)
while :; do
STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
[ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
sleep 5
done
echo "$STATUS"
curl -s -o voice.mp3 "$(curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.audio[0].url')"
Python
# pip install requests | HP_KEY=hp_… python voice.py
import os, time, requests
BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}
job = requests.post(f"{BASE}/voice-design", headers=H, json={
"text": "Welcome aboard. Mind the gap between the dock and the deck.",
"voice_description": "A calm, weathered old sailor with a low, gravelly voice and a slow pace",
"seed": 42,
})
job.raise_for_status()
job = job.json()
print("job", job["request_id"], "costs", job["credits"], "credits")
while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
time.sleep(5)
result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
raise SystemExit(f"{result['status']}: {result.get('error', '')}")
with open(f"voice-{job['request_id']}.mp3", "wb") as f:
f.write(requests.get(result["audio"][0]["url"]).content)