Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hclsys
Copy link
Contributor

@hclsys hclsys commented Jan 28, 2026

Summary

Fixes #2816

  • Changed OPENAI_TTS_BASE_URL from module-level constant to getOpenAITtsBaseUrl() function
  • Changed isCustomOpenAIEndpoint from constant to isCustomOpenAIEndpoint() function
  • Allows config.env settings to take effect after gateway startup

Root Cause

The TTS module reads OPENAI_TTS_BASE_URL at module import time as a constant, but config.env is loaded after modules are imported. This means custom OpenAI-compatible TTS endpoints (like Kokoro) were never used.

Changes

Location Before After
Line 763-771 const OPENAI_TTS_BASE_URL = ... function getOpenAITtsBaseUrl(): string
Line 769-771 const isCustomOpenAIEndpoint = ... function isCustomOpenAIEndpoint(): boolean
Line 792 if (isCustomOpenAIEndpoint) if (isCustomOpenAIEndpoint())
Line 798 if (isCustomOpenAIEndpoint) if (isCustomOpenAIEndpoint())
Line 1025 ${OPENAI_TTS_BASE_URL}/audio/speech ${getOpenAITtsBaseUrl()}/audio/speech

Test plan

  • TypeScript compiles without errors
  • CI tests pass
  • Behavior: Without env → default api.openai.com
  • Behavior: With env → uses custom URL

🤖 Generated with Claude Code

Fixes moltbot#2816

Changed OPENAI_TTS_BASE_URL from a module-level constant to a function
that reads process.env at call time. This allows config.env settings to
take effect after gateway startup.

Changes:
- OPENAI_TTS_BASE_URL constant → getOpenAITtsBaseUrl() function
- isCustomOpenAIEndpoint constant → isCustomOpenAIEndpoint() function
- Updated 3 call sites to use function calls

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@hclsys hclsys force-pushed the fix/tts-base-url-runtime-read-2816 branch from 71ef7ae to ecf270f Compare January 28, 2026 13:31
@shakkernerd shakkernerd merged commit 2f6e1ac into openclaw:main Jan 28, 2026
19 of 23 checks passed
lawrence565 pushed a commit to lawrence565/moltbot that referenced this pull request Jan 29, 2026
HirokiKobayashi-R pushed a commit to HirokiKobayashi-R/moltbot that referenced this pull request Jan 29, 2026
mfgering pushed a commit to mfgering/mfg_moltbot that referenced this pull request Jan 29, 2026
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.

Bug: OPENAI_TTS_BASE_URL ignored - captured at module import before config.env loads

2 participants