Skip to content

Add Gandr as a provider to the Text-to-Speech block - #7282

Open
AALG123 wants to merge 1 commit into
simstudioai:mainfrom
AALG123:add-gandr-tts
Open

Add Gandr as a provider to the Text-to-Speech block#7282
AALG123 wants to merge 1 commit into
simstudioai:mainfrom
AALG123:add-gandr-tts

Conversation

@AALG123

@AALG123 AALG123 commented Aug 30, 2026

Copy link
Copy Markdown

This adds Gandr as an eighth provider to the existing Text-to-Speech block, next to OpenAI, Deepgram, ElevenLabs, Cartesia, Google Cloud, Azure, and PlayHT. It follows the same pattern as the other providers at every layer, closest to the OpenAI one since Gandr's speech endpoint is OpenAI compatible.

What changed:

  • apps/sim/tools/tts/gandr.ts (new): gandrTtsTool with id tts_gandr, mirroring openai.ts. Params are text, apiKey, voice (default gandr-mia), and responseFormat (default mp3). Same operation.modelInput projection, operation.input materialization, transformResponse, and outputs shape as the other unified TTS tools.
  • apps/sim/tools/tts/types.ts: 'gandr' added to the TtsProvider union, plus a GandrTtsParams interface (voices gandr-mia, gandr-ava, gandr-jenny, gandr-dane, gandr-leo, gandr-lewis; formats mp3, wav, pcm).
  • apps/sim/tools/tts/index.ts: exports gandrTtsTool.
  • apps/sim/lib/internal/tts/client.ts: synthesizeGandr posts to https://tts.gandr.ai/v1/audio/speech with a Bearer key and body {"model": "tts-1", "input": text, "voice": voice, "response_format": format}, using the shared providerFetch, error reader, and audio size limits. Gandr accepts up to 2000 characters per request, so longer text raises a TtsOperationError with status 400 instead of a silent provider error.
  • apps/sim/lib/internal/tts/operations.ts: executeGandrTts stores audio through the shared storeUnifiedAudio path.
  • apps/sim/lib/internal/tts/execute-tool.ts: tts_gandr zod schema (voice and format enums) and its switch case.
  • apps/sim/lib/internal/tool-operations/registry.server.ts: 'tts_gandr' added to TTS_TOOL_IDS.
  • apps/sim/tools/registry.ts: import and tts_gandr: gandrTtsTool registry entry.
  • apps/sim/blocks/blocks/tts.ts: Gandr in the provider dropdown, a voice dropdown and an audio format dropdown gated on provider === 'gandr', the tools.access entry, the tool selector case, the params mapping, and the updated provider list strings.
  • apps/sim/tools/tts/operations.test.ts: gandrTtsTool added to the declaration checks and an input materialization expectation matching the OpenAI one.

Verification: at this branch's base commit, vitest run tools/tts/operations.test.ts from apps/sim passes (1 file, 2 tests). I ran it with --pool=forks because the default thread pool fails in my headless environment independent of this change; bun install there also needed --ignore-scripts since isolated-vm's native build wants system toolchain pieces. Neither flag touches what this PR changes.

About the provider: Gandr is a text to speech API with six stock voices, support for 23 languages, and a watermark on every render. Keys come from https://gandr.ai; the free tier includes 50,000 tokens. The API is OpenAI compatible, which is why the request in client.ts looks like the OpenAI one with a different base URL.

No behavior changes for the existing providers. The new provider only runs when a user selects Gandr in the block.

Disclosure: I work on Gandr.

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 30, 2026 7:37am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Gandr as a selectable text-to-speech provider using the existing unified TTS execution and audio-storage pipeline.

  • Defines Gandr tool metadata, parameter types, voices, formats, and defaults.
  • Adds the Gandr HTTP client, execution operation, validation schema, and tool registries.
  • Exposes Gandr configuration through the TTS workflow block and extends declaration tests.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking documentation-style inconsistency in the new Gandr parameter type.

The Gandr provider is wired through the established validation, execution, provider-client, and storage layers; the remaining accepted concern is limited to declaration comments that should use TSDoc.

Files Needing Attention: apps/sim/tools/tts/types.ts

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/tts.ts Adds Gandr provider selection, voice and format controls, tool routing, and parameter materialization consistently with sibling providers.
apps/sim/lib/internal/tts/client.ts Adds the fixed-endpoint Gandr synthesis request, character-limit validation, shared response limits, and audio metadata mapping.
apps/sim/lib/internal/tts/execute-tool.ts Adds Gandr input validation and dispatch to the unified TTS operation.
apps/sim/lib/internal/tts/operations.ts Connects Gandr synthesis to the existing unified audio-storage path.
apps/sim/tools/tts/gandr.ts Declares the Gandr internal tool, safe API-key visibility, defaults, projected model input, and standard outputs.
apps/sim/tools/tts/types.ts Adds Gandr provider and parameter types correctly, but declaration documentation does not follow the required TSDoc convention.
apps/sim/tools/tts/operations.test.ts Extends declaration and default-input coverage to the Gandr tool.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  B[TTS block: Gandr selected] --> T[tts_gandr tool]
  T --> V[Validate voice and format]
  V --> O[executeGandrTts]
  O --> C[synthesizeGandr]
  C --> G[Gandr speech API]
  G --> S[Shared audio storage]
  S --> R[TTS response with audio URL and file]
Loading

Reviews (1): Last reviewed commit: "Add Gandr as a provider to the Text-to-S..." | Re-trigger Greptile

Comment on lines +58 to +60
// Gandr TTS Types
export interface GandrTtsParams {
text: string // up to 2000 characters per request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Gandr declaration lacks TSDoc

The exported GandrTtsParams declaration and its text constraint use line comments instead of the required TSDoc form, preventing TSDoc-aware tooling from consuming this public parameter documentation consistently.

Suggested change
// Gandr TTS Types
export interface GandrTtsParams {
text: string // up to 2000 characters per request
/** Gandr TTS parameters. */
export interface GandrTtsParams {
/** Text to synthesize, up to 2000 characters per request. */
text: string

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant