Skip to content

Gandr TTS as a LangChain tool.

One pip install, then a standard agent tool your LLM can call.

Ask Claude CodeAsk ChatGPT

The whole integration

Install, construct, hand to the agent.

Integration
pip install gandr-langchain

from gandr_langchain import GandrText2SpeechTool

tool = GandrText2SpeechTool(voice="gandr-leo")

The tool is a standard LangChain tool, so it plugs into any agent that accepts a tool list. The key comes from GANDR_API_KEY.

What it needs

What it takes

One packagepip install gandr-langchain
A keyGANDR_API_KEY in the environment
LangChainAny recent version with tool support
Python3.9 or newer

Speech as a tool your LLM can call

A LangChain agent already picks tools by description. GandrText2SpeechTool is a standard LangChain tool, so the agent decides when an answer should be spoken and calls the tool like any other.

The voice is set at construction, so an agent can carry a consistent voice across turns. The key comes from GANDR_API_KEY in the environment.

What the flat stream changes

An agent that speaks every answer burns characters fast on a per-character meter. On a flat stream the agent talks as much as the work needs and nothing is counted.

  • Standard tool shape, plugs into any tool list
  • One stream carries a whole agent fleet
  • No per-character meter on agent speech

Notes

Does the tool work with any LangChain agent?

Yes. It is a standard LangChain tool, so any agent that accepts a tool list can use it.

How do I set the voice?

Pass a voice id at construction, for example GandrText2SpeechTool(voice="gandr-leo"). The key is read from GANDR_API_KEY.

A key and one stream, and your LangChain agent speaks.

Get a key

Full API reference , gandr.ai/docs