gandr-haystack
Gandr text to speech as a Haystack component.
Install
pip install gandr-haystack
Use
import os
from gandr_haystack import GandrTTS
tts = GandrTTS(voice="gandr-mia") # reads GANDR_API_KEY from the env
result = tts.run(text="Your appointment is confirmed for Tuesday at two fifteen.",
path="out.wav")
result["audio"] # WAV bytes
In a pipeline:
from haystack import Pipeline
pipe = Pipeline()
pipe.add_component("tts", GandrTTS())
pipe.run({"tts": {"text": "Hello from Haystack."}})
Parameters
| Parameter | Default | Notes |
|---|---|---|
api_key |
Secret.from_env_var("GANDR_API_KEY") |
Keys start with gnd_ |
voice |
gandr-mia |
Also gandr-ava, gandr-jenny, gandr-dane, gandr-leo, gandr-lewis |
language |
en |
ISO code |
sample_rate |
24000 |
One of 8000, 16000, 22050, 24000 |
url |
https://tts.gandr.ai/v1/tts/bytes |
Override to pin a region |
timeout |
60.0 |
Seconds |
run() returns {"audio": bytes, "path": str | None}. Pass path to write the
WAV to disk as well as returning it.
The component serializes with to_dict() and from_dict(), and the key is held
as a Haystack Secret read from the environment, so saved pipelines never carry
the token.
Loading a saved pipeline
Haystack will not deserialize a third-party component unless its module is allowlisted. That is Haystack's security model, not a quirk of this package, and it applies to every community integration:
from haystack.core.serialization import allow_deserialization_module
allow_deserialization_module("gandr_haystack.tts")
Or set HAYSTACK_DESERIALIZATION_ALLOWLIST=gandr_haystack.tts in the environment.
Saving with to_dict() needs nothing.
Errors
An HTTP failure raises RuntimeError carrying the API's own status and message,
so a 401 (key) and a 402 (quota) are told apart rather than guessed at.
Pricing
$10 per million tokens, or $150 a month for one unlimited concurrent stream. Free key, 50,000 tokens: gandr.ai
License
MIT.
Metadata
Release files for gandr-haystack 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gandr_haystack-0.1.2.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gandr_haystack-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / gandr_haystack-0.1.2.tar.gz
| Download URL | gandr_haystack-0.1.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8d382dafd16ae886162f920ef35c31ebf72fd1769a381d0b3b64c43884988ef
|
|
BLAKE2b-256 checksum How to use checksums |
4731931d63f82bccbe882ddc6ffc97466424b9c836bb2aeaeb59e3c4be56a92c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gandr_haystack-0.1.2-py3-none-any.whl
| Download URL | gandr_haystack-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b9ad168d5b0e0cf7b514b703d64f4c4bd4a73caa5cd0a6a2d5d0fbaae248299
|
|
BLAKE2b-256 checksum How to use checksums |
ae23040c6673f38a32427877416a9ecf47fe738f9e276a0d104a6225da8a9418
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|