Skip to content

feat(OpenAI Node): Add gpt-4o-mini-tts model with new voices and parameters - #250

Open
everettbu wants to merge 5 commits into
masterfrom
feat/openai-node-tts-enhancements
Open

feat(OpenAI Node): Add gpt-4o-mini-tts model with new voices and parameters#250
everettbu wants to merge 5 commits into
masterfrom
feat/openai-node-tts-enhancements

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of n8n-io/n8n#21944
Original author: mo-sil


Summary

Adds complete support for OpenAI's latest Text-to-Speech features, bringing the node to 100% API parity with the OpenAI Audio API.

Changes

New Model

  • gpt-4o-mini-tts - OpenAI's next-generation audio model with improved steerability

New Voices (5)

  • ash - Available on all models
  • coral - Available on all models
  • sage - Available on all models
  • ballad - gpt-4o-mini-tts exclusive
  • verse - gpt-4o-mini-tts exclusive

New Audio Formats (2)

  • wav - Waveform Audio File Format
  • pcm - Raw 16-bit low-endian PCM audio

New Parameters

  • instructions - Control voice characteristics (gpt-4o-mini-tts only)
  • stream_format - Choose between audio or sse streaming

Implementation Details

  • Conditional voice display: ballad and verse only appear when gpt-4o-mini-tts is selected
  • DRY implementation: Voice lists are defined once and reused
  • Voices automatically sorted alphabetically for better UX

Testing

  • ✅ 37 comprehensive test cases added
  • ✅ Tests cover all models, voices, formats, and parameters
  • ✅ Separate test suites for common and model-exclusive voices
  • ✅ All tests passing

Validation

  • ✅ Tested with actual OpenAI API
  • ✅ Verified voice exclusivity (ballad/verse only work with gpt-4o-mini-tts)
  • ✅ All linting checks pass
  • ✅ TypeScript compliant

Breaking Changes

None. This is a backward-compatible feature addition.

Related


Checklist:

  • Code follows n8n style guide
  • No ts-ignore used
  • Tests included and passing
  • No repetitive code (DRY principle applied)
  • Single feature focus (TTS enhancements)
  • TypeScript compliant

Note

Adds gpt-4o-mini-tts support with expanded voice options, new audio formats, instructions/stream_format params, and comprehensive tests for audio generation.

  • OpenAI Audio TTS (packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.ts):
    • Model: Add gpt-4o-mini-tts.
    • Voices:
      • Split voice options by model; reuse shared list commonVoices and add model-specific ballad/verse for gpt-4o-mini-tts (alphabetically sorted).
    • Formats: Add wav and pcm to response_format options.
    • Params: Add instructions and stream_format (exposed only for gpt-4o-mini-tts) and include in request body when provided.
    • Behavior: Streamed request via POST /audio/speech; supports custom binary output field.
  • Tests (packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/test/v2/actions/audio/generate.operation.test.ts):
    • Add extensive tests covering models, voices (common and exclusive), formats, speed, instructions, stream_format, and custom binary field.

Written by Cursor Bugbot for commit 94f9c34. This will update automatically on new commits. Configure here.

mo-sil and others added 5 commits November 17, 2025 15:15
- Add gpt-4o-mini-tts model support
- Add new voices: ash, ballad, coral, sage, verse
- Add new audio formats: wav, pcm
- Add instructions parameter (gpt-4o-mini-tts only)
- Add stream_format parameter
- Implement conditional voice display based on model selection
- Add comprehensive test coverage (37 test cases)

The ballad and verse voices are exclusively available for gpt-4o-mini-tts
as they are not supported by tts-1 and tts-1-hd models.
…ions

- Update test case to reflect changes in model name for audio generation
- Modify stream_format options to conditionally display based on selected model
- Ensure comprehensive test coverage for audio generation functionality
@everettbu everettbu added community Authored by a community member in linear Issue or PR has been created in Linear for internal review labels Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member in linear Issue or PR has been created in Linear for internal review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants