Skip to main content

Official Python client for the Kova TTS API.

Project description

kova-tts

Python client for the Kova TTS API.

Install

pip install kova-tts

Setup

from kova_tts import KovaTTSClient

client = KovaTTSClient(
    api_key="YOUR_API_KEY",
)

Sync

from kova_tts import AudioResponseFormat

result = client.tts(
    text="Hello world.",
    voice="cal",
    response_format=AudioResponseFormat(encoding="mp3"),
    timestamps=True,
    normalize_text=True,
)

client.write_audio_file(result.audio, "out.mp3")
print(result.timestamps.words if result.timestamps else None)

Streaming

from kova_tts import AudioResponseFormat

async for event in client.stream_tts(
    text="Hello world.",
    voice="cal",
    response_format=AudioResponseFormat(encoding="mp3"),
    timestamps=True,
    normalize_text=True,
):
    if event.type == "audio":
        print(f"received {len(event.audio)} audio bytes")
    elif event.type == "timestamps":
        print(event.words)

WebSocket

from kova_tts import AudioResponseFormat

async with client.websocket() as ws:
    await ws.start_context(
        context_id="ctx-1",
        voice_id="cal",
        model_id="default",
        timestamps=True,
        response_format=AudioResponseFormat(encoding="pcm", sample_rate=32000),
    )

    await ws.send_text("Hello ", context_id="ctx-1")
    await ws.send_text("world.", context_id="ctx-1")
    await ws.flush(context_id="ctx-1")

    async for frame in ws:
        match frame.type:
            case "audio":
                print(f"received {len(frame.audio)} audio bytes")
            case "timestamps":
                print(frame.timestamps.words)
            case "flush_completed":
                break

Response Formats

response_format supports mp3, pcm, wav, linear16, opus, mulaw, and alaw.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kova_tts-0.1.5.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kova_tts-0.1.5-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file kova_tts-0.1.5.tar.gz.

File metadata

  • Download URL: kova_tts-0.1.5.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kova_tts-0.1.5.tar.gz
Algorithm Hash digest
SHA256 83149feb6074211b09a18fac6c42c4a8e7b6fb3e903f04283402d9f50b1c1fb5
MD5 028b8ca083748b583df030c0924b372f
BLAKE2b-256 ae6c14382d300fea16e1feac5477fc6c091d6449466678f598076640f1936590

See more details on using hashes here.

Provenance

The following attestation bundles were made for kova_tts-0.1.5.tar.gz:

Publisher: publish-python.yml on evalabs-ai/kova-tts-clients

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kova_tts-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: kova_tts-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kova_tts-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc9006b701d5fefb1bb2d34aacbad09a4c93ccfc894551f6a0218cf4c1ab6dc
MD5 d5713b1c107b489c988d3aa8b479a351
BLAKE2b-256 a0ba090e3e4949bb3cdab0a6279dad61328f77cd77a547ceed95bc4a4c54ce63

See more details on using hashes here.

Provenance

The following attestation bundles were made for kova_tts-0.1.5-py3-none-any.whl:

Publisher: publish-python.yml on evalabs-ai/kova-tts-clients

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page