Skip to main content

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, 100,000 tokens, no card: gandr.ai

License

MIT.

Download files

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

Source Distribution

gandr_haystack-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

gandr_haystack-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file gandr_haystack-0.1.1.tar.gz.

File metadata

  • Download URL: gandr_haystack-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for gandr_haystack-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0bb52e1249487fdb71fe1ffc48aee43eb5f53c02e0ea3c6525d9ca4d7b44910
MD5 4937a6e5173ff413350a41931f543a65
BLAKE2b-256 0f2fa6a9b0e34a19eef206d49a2d8be6d652417f0479f8e42fd85daab9f9cad3

See more details on using hashes here.

File details

Details for the file gandr_haystack-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gandr_haystack-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for gandr_haystack-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11b6e2f06f93d50da86288b0764401d1bcc7d1de24629cbf9873906a5eceafed
MD5 74b32ea0352e21211262bd8385fbe57b
BLAKE2b-256 b4eba4c677536c5fdc67eff2de724d56ae23da557d52c0fe3b5a2b19a985a2b3

See more details on using hashes here.

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