Text-to-Speech (TTS)
Convert text to speech audio. Billing: charged per character count (punctuation
included). The response is a binary audio stream; Content-Type varies with
response_format.
The request body includes model (e.g. seed-tts-2.0), input (text to
synthesize), voice (voice ID), plus optional speed (speaking rate),
response_format (output format), and instructions (voice instructions,
not billed).
For native Volcengine parameters (ssml, explicit_language,
aigc_watermark, etc.), use the native passthrough endpoint
POST /v1/audio/speech/unidirectional instead.
Authorization
BearerAuth API key authentication (OpenAI format). Pass in the Authorization header:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.ai/v1/audio/speech" \ -H "Content-Type: application/json" \ -d '{ "model": "volcengine/seed-tts-2.0", "input": "Hello, welcome to XRToken." }'"string"{
"error": "string",
"type": "invalid_request_error"
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "insufficient balance -- please top up or upgrade your plan",
"type": "billing_error"
}{
"error": "rate limit exceeded",
"type": "rate_limit_error"
}{
"error": "upstream provider error",
"type": "server_error"
}