v1
latestOpenAPI 3.1.02026-07-13212942.9 KBSync Text To Speech
Synthesise speech and return the audio file directly.
Validates quota, synthesises audio via :func:_generate_tts_bytes, writes the result to a temporary file, and returns it as a FileResponse. The temp file is deleted in a background task after the response is sent.
Args: tts_request: TTS parameters (text, voice, model, output format, etc.). background_tasks: FastAPI background-task queue used to schedule temp-file cleanup. token_service: Injected token validation service. _request: Raw FastAPI Request used for rate-limiting. x_api_key: Bearer API key from the x-api-key header. version: API version extracted from the version request header. tts_service_stub: gRPC stub connected to the XCODEC synthesis server.
Returns: FileResponse: Audio file in the format requested by tts_request.output_format.
Raises: UsageLimitExceeded: When the token has exhausted its quota.
Headers
Request body
Example request
{
"transcript": "Hello, world!"
}Response
Successful Response