LLM to TTS

Production-ready LLM ->TTS endpoint to integrate into your app
LLM to TTS background
LLM to TTS

Input

textimagesaudiovideo

Output

audiotextimagesvideo

Use Cases

Language LearningCustomer SupportAI CompanionGamesFitness TrainerSocial Media

Type

full-stack appcallable endpoint

SDK

Node.js

README.md

GitHub

LLM + TTS Pipeline

MIT License Powered by Inworld AI Documentation Model Providers

Production-ready LLM → TTS endpoint to integrate into your app.

Prerequisites

  • Node.js (v20 or higher)

Get Started

Step 1: Clone the Repository

git clone https://github.com/inworld-ai/llm-to-tts-node
cd llm-to-tts-node

Step 2: Install Dependencies

npm install

Step 3: Authenticate

Log in to your Inworld account:

inworld login

Step 4: Run the Application

Test locally with instant feedback:

inworld run ./graph.ts '{"input": {"user_input": "Hello, how are you?"}}'

Serve as an HTTP server with Swagger UI:

inworld serve ./graph.ts --swagger

Serve on custom port:

inworld serve ./graph.ts --port 8080

Step 5: Deploy to Inworld Cloud

Deploy your graph to Inworld Cloud to create a persistent, production-ready endpoint:

inworld deploy ./graph.ts

Repo Structure

llm-to-tts-node/
├── graph.ts              # Main graph file with the LLM-TTS pipeline
├── metadata.json         # Graph metadata
├── package.json          # Project dependencies and scripts
├── README.md             # Documentation
└── LICENSE               # MIT License

Architecture

The graph uses a SequentialGraphBuilder with the following nodes in order:

  1. LLMChatRequestBuilderNode - Formats user input into LLM chat messages
  2. RemoteLLMChatNode - Sends requests to the LLM provider and receives responses
  3. TextChunkingNode - Breaks text into optimal chunks for TTS processing
  4. RemoteTTSNode - Converts text chunks to speech

Customization

Changing the LLM Provider

Edit the RemoteLLMChatNode configuration in {{graphFileName}}:

new RemoteLLMChatNode({
  provider: 'anthropic', // Change to 'anthropic', 'google', etc.
  modelName: 'claude-3-sonnet', // Change to desired model
  stream: true,
  // Add other provider-specific options
});

Modifying the System Prompt

Add system messages to the LLMChatRequestBuilderNode:

new LLMChatRequestBuilderNode({
  messages: [
    {
      role: 'system',
      content: { type: 'text', text: 'You are a helpful assistant...' },
    },
    {
      role: 'user',
      content: { type: 'template', template: '{{user_input}}' },
    },
  ],
});

Customizing TTS Settings

Configure the TTS node for different voices or providers:

new RemoteTTSNode({
  speakerId: 'Dennis',
  modelId: 'inworld-tts-1-max',
});

Adding Additional Processing

You can insert additional nodes into the pipeline:

const graphBuilder = new SequentialGraphBuilder({
  id: 'custom-text-node-llm',
  nodes: [
    new LLMChatRequestBuilderNode({...}),
    new RemoteLLMChatNode({...}),
    new CustomProcessingNode(),  // Your custom node
    new TextChunkingNode(),
    new RemoteTTSNode(),
  ],
});

Deployment

To package your graph for deployment:

npm run deploy
# or
npx inworld deploy {{graphFileName}}

This will create a deployment package that can be uploaded to Inworld Cloud.

Troubleshooting

For more information about:

  • Inworld Runtime: Visit the documentation
  • LLM providers: Check provider-specific documentation
  • TTS options: See the TTS provider documentation

Bug Reports: GitHub Issues

General Questions: For general inquiries and support, please email us at support@inworld.ai

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright © 2021-2025 Inworld AI