Rename OPENAI_API_KEY to HERMES_OPENAI_API_KEY in configuration and codebase for clarity and to avoid conflicts. Update related documentation and error messages to reflect the new key name, ensuring backward compatibility with existing setups.
This commit is contained in:
@@ -143,12 +143,13 @@ BROWSER_INACTIVITY_TIMEOUT=120
|
||||
# Contains full conversation history in trajectory format for debugging/replay
|
||||
|
||||
# =============================================================================
|
||||
# VOICE TRANSCRIPTION (Speech-to-Text)
|
||||
# VOICE TRANSCRIPTION & OPENAI TTS
|
||||
# =============================================================================
|
||||
# Required for automatic voice message transcription on messaging platforms.
|
||||
# Uses OpenAI's Whisper API directly (not via OpenRouter).
|
||||
# Required for voice message transcription (Whisper) and OpenAI TTS voices.
|
||||
# Uses OpenAI's API directly (not via OpenRouter).
|
||||
# Named HERMES_OPENAI_API_KEY to avoid interference with OpenRouter.
|
||||
# Get at: https://platform.openai.com/api-keys
|
||||
OPENAI_API_KEY=
|
||||
HERMES_OPENAI_API_KEY=
|
||||
|
||||
# =============================================================================
|
||||
# SLACK INTEGRATION
|
||||
|
||||
@@ -700,10 +700,10 @@ class GatewayRunner:
|
||||
)
|
||||
else:
|
||||
error = result.get("error", "unknown error")
|
||||
if "OPENAI_API_KEY" in error:
|
||||
if "OPENAI_API_KEY" in error or "HERMES_OPENAI_API_KEY" in error:
|
||||
enriched_parts.append(
|
||||
"[The user sent a voice message but I can't listen "
|
||||
"to it right now~ OPENAI_API_KEY isn't set up yet "
|
||||
"to it right now~ HERMES_OPENAI_API_KEY isn't set up yet "
|
||||
"(';w;') Let them know!]"
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -201,11 +201,11 @@ OPTIONAL_ENV_VARS = {
|
||||
"password": False,
|
||||
"advanced": True, # Hide from standard migrate flow
|
||||
},
|
||||
"OPENAI_API_KEY": {
|
||||
"description": "OpenAI API key (voice transcription + custom endpoint)",
|
||||
"prompt": "OpenAI API Key",
|
||||
"HERMES_OPENAI_API_KEY": {
|
||||
"description": "OpenAI API key for voice transcription (Whisper) and OpenAI TTS",
|
||||
"prompt": "OpenAI API Key (for Whisper STT + TTS)",
|
||||
"url": "https://platform.openai.com/api-keys",
|
||||
"tools": ["voice_transcription"],
|
||||
"tools": ["voice_transcription", "openai_tts"],
|
||||
"password": True,
|
||||
},
|
||||
"SLACK_BOT_TOKEN": {
|
||||
@@ -603,7 +603,7 @@ def show_config():
|
||||
keys = [
|
||||
("OPENROUTER_API_KEY", "OpenRouter"),
|
||||
("ANTHROPIC_API_KEY", "Anthropic"),
|
||||
("OPENAI_API_KEY", "OpenAI"),
|
||||
("HERMES_OPENAI_API_KEY", "OpenAI (STT/TTS)"),
|
||||
("FIRECRAWL_API_KEY", "Firecrawl"),
|
||||
("BROWSERBASE_API_KEY", "Browserbase"),
|
||||
("FAL_KEY", "FAL"),
|
||||
@@ -703,7 +703,7 @@ def set_config_value(key: str, value: str):
|
||||
"""Set a configuration value."""
|
||||
# Check if it's an API key (goes to .env)
|
||||
api_keys = [
|
||||
'OPENROUTER_API_KEY', 'ANTHROPIC_API_KEY', 'OPENAI_API_KEY',
|
||||
'OPENROUTER_API_KEY', 'ANTHROPIC_API_KEY', 'HERMES_OPENAI_API_KEY',
|
||||
'FIRECRAWL_API_KEY', 'BROWSERBASE_API_KEY', 'BROWSERBASE_PROJECT_ID',
|
||||
'FAL_KEY', 'TELEGRAM_BOT_TOKEN', 'DISCORD_BOT_TOKEN',
|
||||
'TERMINAL_SSH_HOST', 'TERMINAL_SSH_USER', 'TERMINAL_SSH_KEY',
|
||||
|
||||
@@ -47,12 +47,15 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
|
||||
- "transcript" (str): The transcribed text (empty on failure)
|
||||
- "error" (str, optional): Error message if success is False
|
||||
"""
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
# Use HERMES_OPENAI_API_KEY to avoid interference with the OpenAI SDK's
|
||||
# auto-detection of OPENAI_API_KEY (which would break OpenRouter calls).
|
||||
# Falls back to OPENAI_API_KEY for backward compatibility.
|
||||
api_key = os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
||||
if not api_key:
|
||||
return {
|
||||
"success": False,
|
||||
"transcript": "",
|
||||
"error": "OPENAI_API_KEY not set",
|
||||
"error": "HERMES_OPENAI_API_KEY not set",
|
||||
}
|
||||
|
||||
audio_path = Path(file_path)
|
||||
@@ -100,4 +103,4 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
|
||||
|
||||
def check_stt_requirements() -> bool:
|
||||
"""Check if OpenAI API key is available for speech-to-text."""
|
||||
return bool(os.getenv("OPENAI_API_KEY"))
|
||||
return bool(os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY"))
|
||||
|
||||
@@ -207,9 +207,9 @@ def _generate_openai_tts(text: str, output_path: str, tts_config: Dict[str, Any]
|
||||
Returns:
|
||||
Path to the saved audio file.
|
||||
"""
|
||||
api_key = os.getenv("OPENAI_API_KEY", "")
|
||||
api_key = os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY", "")
|
||||
if not api_key:
|
||||
raise ValueError("OPENAI_API_KEY not set. Get one at https://platform.openai.com/api-keys")
|
||||
raise ValueError("HERMES_OPENAI_API_KEY not set. Get one at https://platform.openai.com/api-keys")
|
||||
|
||||
oai_config = tts_config.get("openai", {})
|
||||
model = oai_config.get("model", DEFAULT_OPENAI_MODEL)
|
||||
@@ -389,7 +389,7 @@ def check_tts_requirements() -> bool:
|
||||
return True
|
||||
if _HAS_ELEVENLABS and os.getenv("ELEVENLABS_API_KEY"):
|
||||
return True
|
||||
if _HAS_OPENAI and os.getenv("OPENAI_API_KEY"):
|
||||
if _HAS_OPENAI and (os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")):
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -406,7 +406,7 @@ if __name__ == "__main__":
|
||||
print(f" ElevenLabs: {'✅ installed' if _HAS_ELEVENLABS else '❌ not installed (pip install elevenlabs)'}")
|
||||
print(f" API Key: {'✅ set' if os.getenv('ELEVENLABS_API_KEY') else '❌ not set'}")
|
||||
print(f" OpenAI: {'✅ installed' if _HAS_OPENAI else '❌ not installed'}")
|
||||
print(f" API Key: {'✅ set' if os.getenv('OPENAI_API_KEY') else '❌ not set'}")
|
||||
print(f" API Key: {'✅ set' if (os.getenv('HERMES_OPENAI_API_KEY') or os.getenv('OPENAI_API_KEY')) else '❌ not set'}")
|
||||
print(f" ffmpeg: {'✅ found' if _has_ffmpeg() else '❌ not found (needed for Telegram Opus)'}")
|
||||
print(f"\n Output dir: {DEFAULT_OUTPUT_DIR}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user