Skip to content

fix(tts): honor OpenAI config for streaming - #70307

Closed
aml1973 wants to merge 1 commit into
NousResearch:mainfrom
aml1973:fix/openai-tts-streaming-config
Closed

aml1973 wants to merge 1 commit into
NousResearch:mainfrom
aml1973:fix/openai-tts-streaming-config

Conversation

@aml1973

@aml1973 aml1973 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Desktop streaming TTS for local and other OpenAI-compatible speech endpoints.

The normal OpenAI TTS path honors tts.openai.base_url and the shared audio-key resolution order, but OpenAIStreamer used only OPENAI_BASE_URL and OPENAI_API_KEY. With a local endpoint configured solely in config.yaml, Desktop therefore attempted the public OpenAI endpoint, failed, and fell back to whole-response synthesis.

This change makes the streaming path:

  • use the shared resolve_openai_audio_api_key() resolver, including VOICE_TOOLS_OPENAI_KEY support;
  • prefer tts.openai.base_url from the configured provider section;
  • preserve OPENAI_BASE_URL as the compatibility fallback.

Related Issue

No existing issue found.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated tools/tts_streaming.py to share OpenAI audio credential resolution with batch TTS.
  • Made tts.openai.base_url take precedence over the legacy environment fallback.
  • Added regression coverage for audio-key availability and configured base-URL propagation through the streaming provider resolver.

How to Test

  1. Configure tts.provider: openai, tts.use_gateway: false, and a local OpenAI-compatible /v1 root in tts.openai.base_url.
  2. Set VOICE_TOOLS_OPENAI_KEY, leave OPENAI_BASE_URL unset, restart Desktop, and enable spoken replies.
  3. Confirm speech begins from streamed PCM chunks and the backend does not contact the public OpenAI endpoint.

Automated checks run locally on Windows 10:

39 passed in 7.24s
ruff: All checks passed

The test set included:

tests/tools/test_tts_streaming.py
tests/tools/test_tts_dotenv_fallback.py
tests/hermes_cli/test_web_server_speak_stream.py

A live OpenAI-compatible Qwen TTS service was also verified with response_format: pcm; playback streamed successfully without OPENAI_BASE_URL after applying the fix.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run the entire pytest tests/ -q suite locally (targeted affected tests passed; full CI is delegated to GitHub Actions)
  • I've added tests for my changes
  • I've tested on Windows 10 with Hermes Desktop and a local OpenAI-compatible TTS endpoint

Documentation & Housekeeping

  • Documentation update is N/A; this fixes existing documented configuration behavior
  • cli-config.yaml.example update is N/A; no config keys changed
  • CONTRIBUTING.md / AGENTS.md update is N/A; no architecture or workflow changed
  • Cross-platform impact considered; the change uses existing config and credential helpers
  • Tool descriptions/schemas update is N/A

Use the shared OpenAI audio key resolver and prefer tts.openai.base_url over the global environment fallback in the Desktop streaming path. Add focused regression coverage for credential and endpoint propagation.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/tts Text-to-speech and transcription provider/openai OpenAI / Codex Responses API area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 23, 2026
teknium1 added a commit that referenced this pull request Jul 28, 2026
Follow-up to salvaged PR #70307 (@aml1973): OpenAIStreamer now checks
tts.openai.api_key (config.yaml) ahead of the env resolver in both
available() and stream(), completing config parity between the sync
and streaming OpenAI TTS paths.
@teknium1

Copy link
Copy Markdown
Collaborator

Merged into main via consolidated salvage PR #73512 (merge f3cc2bc022). Your OpenAI streaming-path config fix was cherry-picked as e6d6311 with your authorship; a follow-up completed api_key parity in available()/stream().

Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage.

@teknium1 teknium1 closed this Jul 29, 2026
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
Follow-up to salvaged PR NousResearch#70307 (@aml1973): OpenAIStreamer now checks
tts.openai.api_key (config.yaml) ahead of the env resolver in both
available() and stream(), completing config parity between the sync
and streaming OpenAI TTS paths.
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
Follow-up to salvaged PR NousResearch#70307 (@aml1973): OpenAIStreamer now checks
tts.openai.api_key (config.yaml) ahead of the env resolver in both
available() and stream(), completing config parity between the sync
and streaming OpenAI TTS paths.
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
Follow-up to salvaged PR NousResearch#70307 (@aml1973): OpenAIStreamer now checks
tts.openai.api_key (config.yaml) ahead of the env resolver in both
available() and stream(), completing config parity between the sync
and streaming OpenAI TTS paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants