DocsDeveloper

Latency

What actually determines time-to-first-byte, and which request shapes cut it — with no invented numbers.

Six levers, largest first. (1) Endpoint choice: the streaming endpoint has the lowest time-to-first-byte — it forwards raw PCM as the engine produces it, so playback starts while the rest is still rendering — at the price of its narrow contract (voice_id mandatory, five languages, raw pcm_s16le only, 5,000 characters). (2) Text length: the buffered endpoint returns nothing until the take is fully rendered, so its time-to-first-byte grows with the text; short requests return sooner, and several short requests in parallel beat one long one when you have concurrency to spend. (3) output_format: "wav" — or leaving it unset — returns the synthesized master as-is; every other format (mp3, opus, pcm_16000, pcm_24000) adds a transcode hop before the first byte. (4) with_timestamps runs a second engine pass — forced alignment of the finished audio — after synthesis and before the response, so a timestamped request is always slower than the same request without it; ask only when you need the timings. (5) Retries: an Idempotency-Key replay serves the stored audio without re-running the engine — the fastest response the API can give, and it charges nothing. (6) Parallelism: calls above your plan's concurrent-generation cap are not queued server-side — they answer 429 concurrency_limit_exceeded immediately with a Retry-After header — so budget parallel work to the cap (the per-plan numbers are on Rate limits & quotas).

Authentication

Nothing on this page needs a separate scope — these are the same endpoints, with tts:synthesize on your account key. What your plan changes is the concurrency cap, which bounds how far the parallelism advice above can take you.

Create a key in Settings → API Keys. It is shown once, so copy it then. Every example below reads it from $SONICVOX_API_KEY.

Endpoints

POST/api/v1/text-to-speech/streamFull reference →

The low-latency path: chunked raw PCM from the first rendered samples. Its restrictions are checked up front, free of charge — voice_id required, en/zh/ja/ko/yue only, at most 5,000 characters, no output_format, no with_timestamps. The Streaming guide has the full contract and client code for scheduling the PCM.

Scope
tts:synthesize
Credits
⌈characters / 100⌉ × 100, reserved up front and refunded if the stream fails
# --no-buffer matters: without it curl holds the response and the
# time-to-first-byte you measure is curl's, not the API's.
curl https://staging.sonicvox.ai/api/v1/text-to-speech/stream \
  -H "sv-api-key: $SONICVOX_API_KEY" \
  -H "content-type: application/json" \
  --no-buffer \
  -d '{
    "text": "The first chunk arrives while the rest is still rendering.",
    "voice_id": "cmpwrfi46015zkww3t8nui4ye",
    "language": "en"
  }' \
  --output stream.pcm
POST/api/v1/text-to-speechFull reference →

The buffered path: the whole take renders before the first byte, so time-to-first-byte grows with text length. Two optional flags trade latency for function — output_format other than wav adds a transcode hop, and with_timestamps adds a forced-alignment pass after synthesis (and switches the response to JSON with base64 audio). Ask for neither unless you need them.

Scope
tts:synthesize
Credits
⌈characters / 100⌉ × 100
# The fastest buffered shape: wav master returned as-is,
# no transcode, no alignment pass.
curl https://staging.sonicvox.ai/api/v1/text-to-speech \
  -H "sv-api-key: $SONICVOX_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "text": "Short requests return sooner.",
    "voice_id": "cmpwrfi46015zkww3t8nui4ye",
    "output_format": "wav"
  }' \
  --output take.wav

# Each of these adds work BEFORE the first byte:
#   "output_format": "mp3"     → transcode hop
#   "with_timestamps": true    → forced-alignment pass (JSON response)

When it fails

Every error carries type, code, message, request_id and a doc_url. Branch on type for retry policy.

concurrency_limit_exceededMore requests in flight than the plan's concurrent cap. Not a queue — the request is refused with a Retry-After header, and the slot frees when one of your own jobs finishes.
rate_limit_exceededThe per-minute request ceiling — a different limit with a different fix. See Rate limits & quotas.
Every error code →

Next

Was this page helpful?
Latency | SonicVox Docs