Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

.env example

Murtaza Nasir6cbe98a8d69c
diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..32f662f1
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,21 @@
+# OpenRouter API Configuration
+OPENROUTER_API_KEY=your_openrouter_api_key_here
+OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
+# Choose a model compatible with function calling / JSON mode on OpenRouter
+# Example: "openai/gpt-3.5-turbo" or "google/gemini-pro" (check OpenRouter docs for compatible models)
+OPENROUTER_MODEL_NAME="openai/gpt-4o-mini"
+
+# OpenAI API Configuration (for transcription)
+TRANSCRIPTION_API_KEY=your_openai_api_key_here
+TRANSCRIPTION_BASE_URL=http://your_local_api_url:port/v1/
+
+# Whisper Model Configuration
+# Default: "Systran/faster-distil-whisper-large-v3"
+WHISPER_MODEL="Systran/faster-distil-whisper-large-v3"
+
+# Application Settings
+# Set to "false" to disable new account registration
+ALLOW_REGISTRATION="true"
+
+# Security
+SECRET_KEY=your_secret_key_here
diff --git a/app.py b/app.py
index 075cb0a8..8eb86bba 100644
--- a/app.py
+++ b/app.py
@@ -170,8 +170,8 @@ else:
app.logger.error(f"Failed to initialize OpenRouter client: {client_init_e}", exc_info=True)
# Store details for the transcription client (potentially different)
-transcription_api_key = os.environ.get("OPENAI_API_KEY", "cant-be-empty")
-transcription_base_url = os.environ.get("OPENAI_BASE_URL", "http://192.168.68.85:1611/v1/")
+transcription_api_key = os.environ.get("TRANSCRIPTION_API_KEY", "cant-be-empty")
+transcription_base_url = os.environ.get("TRANSCRIPTION_BASE_URL", "https://openrouter.ai/api/v1")
app.logger.info(f"Using OpenRouter model for summaries: {openrouter_model_name}")
@@ -202,8 +202,10 @@ def transcribe_audio_task(app_context, recording_id, filepath, original_filename
base_url=transcription_base_url,
http_client=http_client_no_proxy # Reuse the same client configuration
)
+ # Get the Whisper model name from environment variables
+ whisper_model = os.environ.get("WHISPER_MODEL", "Systran/faster-distil-whisper-large-v3")
transcript = transcription_client.audio.transcriptions.create(
- model="Systran/faster-distil-whisper-large-v3", # Your Whisper model
+ model=whisper_model, # Use model from environment variables
file=audio_file,
language="en" # Specify language if known
)