od ElevenLabs

Mowa ElevenLabs v4: 21 głosów i ponad 90 języków, do 10 000 znaków

elevenlabs/v4/text-to-speech
ElevenLabs v4: generator głosu AI online
  • Głosy: 21
  • Języki: 91
  • Tekst na mowę

Wywołujesz go nazwą modelu elevenlabs/v4/text-to-speech w POST /jobs/createTask, od 0,096 USD.

Nazwa modeluelevenlabs/v4/text-to-speech
EndpointPOST 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/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"

input jest zbudowany ze schematu poniżej, więc przechodzi walidację bez zmian. Zamień prompt i linki na własne.

Cena

OpcjaUSD za 1000 znaków
Standard0,096 USD

Rozliczenie w USD · Wszystkie opcje i ceny: GET /models/elevenlabs/v4/text-to-speech

Limity

Długość tekstu (znaki)
10,000
Głosy
21
Języki
91

Parametry

Te pola pochodzą z tego samego schematu, którym sprawdzamy każde żądanie. Pola spoza listy są odrzucane.

  • textstringWymagane

    Słowa do wypowiedzenia, dokładnie tak, jak są zapisane.

    Zakres
    Liczba znaków: 1 – 10000
  • voice_idstringOpcjonalne

    Wybierz jeden z dostępnych głosów.

    Domyślnie
    "Roger"
    Dozwolone wartości
    "Adam""Alice""Bella""Bill""Brian""Callum""Charlie""Chris""Daniel""Eric""George""Harry""Jessica""Laura""Liam""Lily""Matilda""River""Roger""Sarah""Will"
  • languagestringOpcjonalne

    Język wypowiedzi.

    Domyślnie
    "auto"
    Dozwolone wartości
    "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"+52
  • stabilitynumberOpcjonalne

    Jak równa jest wypowiedź. Niżej oznacza więcej ekspresji i zmienności.

    Domyślnie
    0.5
    Zakres
    0 – 1
  • similarity_boostnumberOpcjonalne

    Jak bardzo mowa trzyma się wybranego głosu.

    Domyślnie
    0.75
    Zakres
    0 – 1
  • output_formatstringOpcjonalne

    Format pliku wyniku.

    Domyślnie
    "mp3_44100_128"
    Dozwolone wartości
    "mp3_44100_128""mp3_44100_64""mp3_22050_32""opus_48000_128""pcm_24000""pcm_16000""wav_44100""ulaw_8000""alaw_8000"
  • text_normalization_modestringOpcjonalne

    Czy liczby, daty i skróty są zapisywane słownie przed odczytaniem.

    Domyślnie
    "auto"
    Dozwolone wartości
    "auto""on""off"
  • clone_strengthnumberOpcjonalne

    Jak mocno stosowany jest profesjonalny klon głosu. Nie wpływa na głosy gotowe.

    Zakres
    0 – 1
  • seedintegerOpcjonalne

    Użyj tej samej wartości seed i tych samych ustawień, aby lepiej kontrolować warunki porównania.

    Zakres
    0 – 4294967295
Surowy JSON Schema
{
  "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 3,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
}

Prawdziwy wynik z ElevenLabs v4

Prompt[laughs] Okay, confession time. The first sourdough starter I ever made, I named him Gerald. [sighs] Gerald lasted six days. But here's what nobody tells you about failing at something small: it's the fastest way to find out what you actually care about. I'm Maya, and this is Second Batch.
To samo żądanie przez API
{
  "model": "elevenlabs/v4/text-to-speech",
  "input": {
    "text": "[laughs] Okay, confession time. The first sourdough starter I ever made, I named him Gerald. [sighs] Gerald lasted six days. But here's what nobody tells you about failing at something small: it's the fastest way to find out what you actually care about. I'm Maya, and this is Second Batch.",
    "voice_id": "Jessica",
    "language": "auto",
    "stability": 0.4
  }
}

Odpowiedzi, odpytywanie i callbacki

Wszystkie modele działają tak samo: utwórz zadanie, a potem odpytuj je albo poczekaj na callback.

Najpierw cena

cURL
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/text-to-speech",
  "input": {
    "text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
    "voice_id": "Roger",
    "language": "auto"
  }
}'

Przed uruchomieniem wyślij tę samą treść żądania do POST /jobs/quote, aby zobaczyć szacowaną i maksymalną opłatę w USD. Wycena nie uruchamia zadania ani nie obciąża salda.

Przyjęte

HTTP
HTTP/1.1 202 Accepted

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "state": "queued"
  },
  "request_id": "req_example_create"
}

HTTP 202 oznacza przyjęcie zadania: maksymalna kwota w USD pozostaje zarezerwowana do rozliczenia. Po przyjęciu zadania rezerwujemy maksymalną kwotę wyceny na saldzie PopNow. Po zakończeniu naliczamy opłatę za rzeczywiste użycie, nie wyższą niż rezerwacja, i zwalniamy resztę. Jeśli zadanie się nie powiedzie, rezerwacja zostaje zwolniona.

Sprawdź status

cURL
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

Odpytuj co kilka sekund, stopniowo wydłużając odstęp, i przestań, gdy state ma wartość succeeded, failed, canceled lub expired.

Gotowe zadanie

JSON
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "model": "elevenlabs/v4/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"
}

Pobierz plik z url przed expiresAt. Potrzebujesz później nowego linku? Poproś o niego przez POST /common/download-url.

Weryfikacja callbacku

Node.js
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
});

Gdy ustawisz callBackUrl, wyślemy ci ukończone zadanie. Przed przetworzeniem zweryfikuj podpis na oryginalnej treści żądania.

Wysyłanie pliku lokalnego

cURL
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.

Publiczne linki https działają bez zmian. Pliki lokalne przechodzą najpierw przez upload-url i commit.