Skip to main content

botnoi-voice-py

Python client for the Botnoi Voice Text-to-Speech API.

  • ✅ Zero dependencies (stdlib only)
  • ✅ Python 3.8+
  • ✅ Type hints throughout
  • ✅ Simple .save() helper to download audio

Installation

pip install botnoi-voice-py

Quick Start

from botnoi_tts import BotnoiTTS

client = BotnoiTTS(token="YOUR_BOTNOI_TOKEN")

# v1
response = client.v1("สวัสดีครับ", speaker="1")
print(response.audio_url)
response.save("output_v1.mp3")

# v2
response = client.v2("สวัสดีครับ", speaker="3")
print(response.audio_url)
response.save("output_v2.mp3")

API Reference

BotnoiTTS(token, timeout=30)

Parameter Type Description
token str Your Botnoi API token
timeout int Request timeout in seconds (default: 30)

client.v1(text, ...) / client.v2(text, ...)

Parameter Type Default Description
text str — Text to synthesise
speaker str "1" Speaker ID
volume float 1.0 0.0 – 2.0
speed float 1.0 0.5 – 2.0
media_type str "mp3" "mp3", "wav", "ogg"
language str "th" "th" or "en"
save_file bool True Persist file on Botnoi servers

ความแตกต่างระหว่าง v1 และ v2:

v1 v2
Endpoint /v1/generate_audio /v1/generate_audio_v2
Speaker support รุ่นเก่า รุ่นใหม่ รองรับ speaker มากกว่า

Returns an AudioResponse object.


AudioResponse

Attribute Type Description
audio_url str Direct URL to the generated audio
media_type str Format of the audio file
text str Input text that was synthesised
speaker str Speaker ID used
version str API version used — "v1" or "v2"
raw dict Full raw API response

.save(path) -> str

Downloads the audio and saves it to path. Returns the absolute file path.

response.save("output")      # saves as output.mp3
response.save("output.wav")  # saves as output.wav

Error Handling

from botnoi_tts import BotnoiTTS, BotnoiAuthError, BotnoiAPIError

client = BotnoiTTS(token="...")

try:
    response = client.v2("สวัสดีครับ", speaker="3")
except BotnoiAuthError:
    print("Invalid token")
except BotnoiAPIError as e:
    print(f"API error {e.status_code}: {e}")
Exception When raised
BotnoiAuthError Token is invalid or missing
BotnoiAPIError Non-200 HTTP response or connection error

License

MIT

Metadata

Release files for botnoi-voice-py 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for botnoi-voice-py 0.1.7
File Size Uploaded Provenance
botnoi_voice_py-0.1.7.tar.gz 5.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for botnoi-voice-py 0.1.7
File Interpreter ABI Platform
botnoi_voice_py-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / botnoi_voice_py-0.1.7.tar.gz

Download URL botnoi_voice_py-0.1.7.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4bcee6136d253b6afd4ce901827f008af5538ef151e881077dcf31028878f373
BLAKE2b-256 checksum
How to use checksums
7e745f08c1abbf1bb5f9b0f6aad3a86721b390343759817fe0c5b9c75b778c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Release files / botnoi_voice_py-0.1.7-py3-none-any.whl

Download URL botnoi_voice_py-0.1.7-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f592ebb7b65593f22d50f134ab915dd12355fe81301f323211c79521436abec
BLAKE2b-256 checksum
How to use checksums
70205e009940744b4886222250068a753a8bbba662bb815ad4d72ddd6ae2e5a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Security for botnoi-voice-py 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for botnoi_voice_py-0.1.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page