Voce ElevenLabs v4 più veloce, con le stesse 21 voci e oltre 90 lingue
ElevenLabs v4 Turbo: generatore di voce IA online- 21 voci
- 91 lingue
- Sintesi vocale
Lo chiami con il nome di modello elevenlabs/v4-turbo/text-to-speech su POST /jobs/createTask, da 0,048 USD.
elevenlabs/v4-turbo/text-to-speechPOST https://api.popnow.ai/api/v1/jobs/createTask# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $POPNOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d '{
"model": "elevenlabs/v4-turbo/text-to-speech",
"input": {
"text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
"voice_id": "Roger",
"language": "auto"
}
}'
# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $POPNOW_API_KEY"// Node 18+ (or any runtime with fetch). Keep the API key on your server.
const BASE = "https://api.popnow.ai/api/v1";
const headers = { Authorization: `Bearer ${process.env.POPNOW_API_KEY}` };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function call(path, init = {}) {
const res = await fetch(BASE + path, { ...init, headers: { ...headers, ...init.headers } });
const body = await res.json();
if (body.code !== 200) throw new Error(`${body.code} ${body.msg}`);
return body.data;
}
const { taskId } = await call("/jobs/createTask", {
method: "POST",
headers: { "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({
"model": "elevenlabs/v4-turbo/text-to-speech",
"input": {
"text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
"voice_id": "Roger",
"language": "auto"
}
}),
});
// Poll with backoff. A finished task may still be copying files: wait while an asset is pending.
let task;
for (let delay = 2000; ; delay = Math.min(delay * 1.5, 15000)) {
await sleep(delay);
task = await call(`/jobs/recordInfo?taskId=${taskId}`);
const copying = (task.output?.assets ?? []).some((a) => a.pending && !a.unavailable);
if (["succeeded", "failed", "canceled", "expired"].includes(task.state) && !copying) break;
}
if (task.state !== "succeeded") throw new Error(`${task.state}: ${task.errorMessage ?? "no detail"}`);
// Each asset has a signed url (no API key needed) that expires at expiresAt: save the file.
for (const asset of task.output.assets) console.log(asset.url);import os, time, uuid, requests
BASE = "https://api.popnow.ai/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['POPNOW_API_KEY']}"}
def call(method, path, **kwargs):
body = requests.request(method, BASE + path, headers={**HEADERS, **kwargs.pop("headers", {})}, timeout=30, **kwargs).json()
if body["code"] != 200:
raise RuntimeError(f'{body["code"]} {body["msg"]}')
return body["data"]
task_id = call(
"POST",
"/jobs/createTask",
headers={"Idempotency-Key": str(uuid.uuid4())}, # reuse it if you retry
json={
"model": "elevenlabs/v4-turbo/text-to-speech",
"input": {
"text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
"voice_id": "Roger",
"language": "auto"
}
},
)["taskId"]
# Poll with backoff. A finished task may still be copying files: wait while an asset is pending.
delay = 2.0
while True:
time.sleep(delay)
task = call("GET", "/jobs/recordInfo", params={"taskId": task_id})
assets = (task.get("output") or {}).get("assets") or []
copying = any(a.get("pending") and not a.get("unavailable") for a in assets)
if task["state"] in ("succeeded", "failed", "canceled", "expired") and not copying:
break
delay = min(delay * 1.5, 15.0)
if task["state"] != "succeeded":
raise RuntimeError(f'{task["state"]}: {task.get("errorMessage", "no detail")}')
# Each asset has a signed url (no API key needed) that expires at expiresAt: save the file.
for asset in assets:
print(asset["url"])L’input è costruito dallo schema qui sotto, quindi supera la verifica così com’è. Sostituisci prompt e link con i tuoi.
Prezzo
| Opzione | USD ogni 1.000 caratteri |
|---|---|
| Standard | 0,048 USD |
Addebiti in USD · Tutte le opzioni e i prezzi: GET /models/elevenlabs/v4-turbo/text-to-speech
Limiti
- Lunghezza del testo (caratteri)
- 10,000
- Voci
- 21
- Lingue
- 91
Parametri
Questi campi vengono dallo stesso schema con cui verifichiamo ogni richiesta. I campi non elencati vengono rifiutati.
textstringObbligatorioLe parole da pronunciare, esattamente come sono scritte.
voice_idstringFacoltativoScegli tra le voci disponibili.
languagestringFacoltativoLa lingua del parlato.
stabilitynumberFacoltativoQuanto è stabile la lettura. Più basso è più espressivo e variabile.
similarity_boostnumberFacoltativoQuanto il parlato resta fedele alla voce scelta.
output_formatstringFacoltativoTipo di file del risultato.
text_normalization_modestringFacoltativoSe numeri, date e abbreviazioni vengono scritti per esteso prima della lettura.
clone_strengthnumberFacoltativoQuanto viene applicato un clone vocale professionale. Nessun effetto sulle voci predefinite.
seedintegerFacoltativoUsa lo stesso seed e le stesse impostazioni per confrontare le varianti in modo più controllato.
JSON Schema completo
{
"type": "object",
"required": [
"text"
],
"properties": {
"seed": {
"type": "integer",
"maximum": 4294967295,
"minimum": 0,
"description": "Random seed for controlled comparisons."
},
"text": {
"type": "string",
"maxLength": 10000,
"minLength": 1,
"description": "The words to speak. Audio tags such as [whispers] or [sighs] are performed, not read. Billed per 1,000 characters. Up to 10,000 characters; about 5,000 or fewer keeps a long read from being cut off."
},
"language": {
"enum": [
"auto",
"af",
"am",
"ar",
"hy",
"as",
"ast",
"az",
"be",
"bn",
"bs",
"bg",
"my",
"yue",
"ca",
"ceb",
"hr",
"cs",
"da",
"nl",
"en",
"et",
"fil",
"fi",
"fr",
"ff",
"gl",
"ka",
"de",
"el",
"gu",
"ha",
"he",
"hi",
"hu",
"is",
"id",
"it",
"ja",
"jv",
"kam",
"kn",
"kk",
"ko",
"ky",
"lo",
"lv",
"ln",
"lt",
"lg",
"lb",
"mk",
"ms",
"ml",
"mt",
"zh",
"mi",
"mr",
"mn",
"ne",
"no",
"oc",
"or",
"ps",
"fa",
"pl",
"pt",
"pa",
"ro",
"ru",
"sr",
"sn",
"sd",
"sk",
"sl",
"so",
"ckb",
"es",
"sw",
"sv",
"tg",
"ta",
"te",
"th",
"tr",
"uk",
"ur",
"uz",
"vi",
"cy",
"wo",
"zu"
],
"type": "string",
"default": "auto",
"description": "Language to enforce, as an ISO code, or auto to detect it from the text."
},
"voice_id": {
"enum": [
"Adam",
"Alice",
"Bella",
"Bill",
"Brian",
"Callum",
"Charlie",
"Chris",
"Daniel",
"Eric",
"George",
"Harry",
"Jessica",
"Laura",
"Liam",
"Lily",
"Matilda",
"River",
"Roger",
"Sarah",
"Will"
],
"type": "string",
"default": "Roger",
"description": "Preset voice."
},
"stability": {
"type": "number",
"default": 0.5,
"maximum": 1,
"minimum": 0,
"description": "How steady the delivery is, 0 to 1. Lower is more expressive and more variable."
},
"output_format": {
"enum": [
"mp3_44100_128",
"mp3_44100_64",
"mp3_22050_32",
"opus_48000_128",
"pcm_24000",
"pcm_16000",
"wav_44100",
"ulaw_8000",
"alaw_8000"
],
"type": "string",
"default": "mp3_44100_128",
"description": "Audio container, sample rate and bitrate. pcm is raw audio without a file header."
},
"clone_strength": {
"type": "number",
"maximum": 1,
"minimum": 0,
"description": "Strength of a professional voice clone, 0 to 1. Has no effect on preset voices."
},
"similarity_boost": {
"type": "number",
"default": 0.75,
"maximum": 1,
"minimum": 0,
"description": "How closely the speech follows the selected voice, 0 to 1."
},
"text_normalization_mode": {
"enum": [
"auto",
"on",
"off"
],
"type": "string",
"default": "auto",
"description": "Whether numbers, dates and abbreviations are spelled out before reading."
}
},
"additionalProperties": false
}Un risultato reale di ElevenLabs v4 Turbo
Welcome to Fieldnote. Tap the microphone and just start talking. We'll turn what you say into a tidy note, with your to-dos pulled out at the top. Nothing is final, so ramble as much as you like.
{
"model": "elevenlabs/v4-turbo/text-to-speech",
"input": {
"text": "Welcome to Fieldnote. Tap the microphone and just start talking. We'll turn what you say into a tidy note, with your to-dos pulled out at the top. Nothing is final, so ramble as much as you like.",
"voice_id": "Sarah",
"language": "auto",
"stability": 0.6
}
}Risposte, polling e callback
Tutti i modelli funzionano allo stesso modo: crei un task, poi lo interroghi o aspetti la callback.
Prima il prezzo
curl -X POST https://api.popnow.ai/api/v1/jobs/quote \
-H "Authorization: Bearer $POPNOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "elevenlabs/v4-turbo/text-to-speech",
"input": {
"text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
"voice_id": "Roger",
"language": "auto"
}
}'Prima di eseguire, invia lo stesso corpo della richiesta a POST /jobs/quote per vedere il costo stimato e quello massimo in USD. Il preventivo non esegue alcuna richiesta né addebita il saldo.
Accettata
HTTP/1.1 202 Accepted
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
"state": "queued"
},
"request_id": "req_example_create"
}HTTP 202 indica che la richiesta è stata accettata: il massimo in USD resta riservato fino al conteggio finale. Quando una richiesta viene accettata, riserviamo l’importo massimo del preventivo sul tuo saldo PopNow. Al termine addebitiamo l’uso effettivo, senza superare la riserva, e liberiamo il resto. Se la richiesta fallisce, l’importo riservato viene sbloccato.
Controlla lo stato
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $POPNOW_API_KEY"Controlla ogni pochi secondi allungando via via l’intervallo e fermati quando state è succeeded, failed, canceled o expired.
Task completato
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
"model": "elevenlabs/v4-turbo/text-to-speech",
"state": "succeeded",
"output": {
"assets": [
{
"url": "https://cdn.popnow.ai/tasks/task_01k3m8x9q2z4v7n5p6r8s0t1w3/output.mp3?signature=FROM_RESPONSE",
"expiresAt": "2026-10-17T12:20:00Z",
"mime": "audio/mpeg",
"durationSeconds": 30
}
]
},
"settled": true
},
"request_id": "req_example_record"
}Scarica dall’url prima di expiresAt. Ti serve un link nuovo più tardi? Chiedilo con POST /common/download-url.
Verifica una callback
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
import express from "express";
const app = express();
// express.raw keeps the exact bytes that were signed; express.json would not match.
app.post("/hooks/popnow", express.raw({ type: "application/json" }), (req, res) => {
const timestamp = req.header("X-Webhook-Timestamp");
const signature = req.header("X-Webhook-Signature") ?? "";
const body = JSON.parse(req.body.toString("utf8"));
const taskId = body.data?.taskId ?? body.task_id;
const digest = createHash("sha256").update(req.body).digest("hex");
const expected = createHmac("sha256", process.env.POPNOW_WEBHOOK_SECRET)
.update(`${taskId}.${timestamp}.${digest}`)
.digest("base64");
const ok = expected.length === signature.length && timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
// Check the signature first, then reject anything older than five minutes.
if (!ok || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return res.status(401).end();
res.status(200).end(); // answer fast, then fetch the task and store its files
});Con callBackUrl impostata ti inviamo il task completato. Verifica la firma sul corpo originale della richiesta prima di elaborarlo.
Invia un file locale
curl -X POST https://api.popnow.ai/api/v1/common/upload-url \
-H "Authorization: Bearer $POPNOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contentType": "image/png", "bytes": 482113}'
# PUT the file bytes to data.uploadUrl with every header in data.headers, then commit it:
curl -X POST https://api.popnow.ai/api/v1/files/$FILE_ID/commit \
-H "Authorization: Bearer $POPNOW_API_KEY"
# The commit returns a popnow://f/... reference. Put it in any image, video or
# audio field of the task input instead of a public https URL.I link https pubblici funzionano così come sono. I file locali passano prima da upload-url e commit.