Skip to content

Latest commit

 

History

History
239 lines (167 loc) · 2.97 KB

File metadata and controls

239 lines (167 loc) · 2.97 KB

Reference

Tts

client.tts.bytes(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]

📝 Description

The easiest way to generate text-to-speech audio. Not suitable for latency-sensitive applications.

🔌 Usage

from respeecher import Respeecher

client = Respeecher(
    api_key="YOUR_API_KEY",
)
client.tts.bytes(
    transcript="Hello, World!",
    voice={"id": "samantha"},
)

⚙️ Parameters

transcript: str — Text for narration.

voice: VoiceParams — Voice for narration.

output_format: typing.Optional[OutputFormatParams] — Audio format specification.

request_options: typing.Optional[RequestOptions] — Request-specific configuration. You can pass in configuration such as chunk_size, and more to customize the request and response.

client.tts.sse(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[ServerSentEvent]]]

📝 Description

Stream text-to-speech audio as JSONL (JSON lines) objects over HTTP. A less performant alternative to WebSockets, without text input streaming.

🔌 Usage

from respeecher import Respeecher

client = Respeecher(
    api_key="YOUR_API_KEY",
)
response = client.tts.sse(
    transcript="Hello, World!",
    voice={"id": "samantha"},
)
for chunk in response.data:
    yield chunk

⚙️ Parameters

transcript: str — Text for narration.

voice: VoiceParams — Voice for narration.

output_format: typing.Optional[StreamingOutputFormatParams] — Audio format specification.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Voices

client.voices.list() -> AsyncHttpResponse[typing.List[Voice]]

📝 Description

List of available voices with IDs and metadata.

🔌 Usage

from respeecher import Respeecher

client = Respeecher(
    api_key="YOUR_API_KEY",
)
client.voices.list()

⚙️ Parameters

request_options: typing.Optional[RequestOptions] — Request-specific configuration.