# PolyTalk Environment Variables # Copy this file to .env and update values as needed # All ${VAR} references in config/config.yaml will use these values # ============================================================================ # APPLICATION LOGGING # ============================================================================ # Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL LOG_LEVEL=INFO # ============================================================================ # STT SERVICE (Local Speech-to-Text with faster-whisper) # ============================================================================ # STT model to use: small, small-v3, medium, large-v3 STT_MODEL=small # Device to run STT: cpu or cuda STT_DEVICE=cpu # Compute type: int8 (CPU) or float16 (CUDA) STT_COMPUTE_TYPE=int8 # Number of STT web workers. Each worker loads its own Whisper model. STT_WORKERS=1 # Load the Whisper model during STT service startup instead of on first stream. STT_PRELOAD_MODEL=true # Max file upload size in MB STT_MAX_UPLOAD_MB=200 # Streaming audio window in seconds. Lower values reduce latency but can reduce # transcript stability. 3.0 gives Whisper more context while pause flush handles utterance endings. STT_STREAM_CHUNK_SECONDS=3.0 # Audio overlap between STT windows. Helps avoid missing words at chunk boundaries. # Keep this modest; too much overlap can increase repeated/hallucinated text. STT_CHUNK_OVERLAP_SECONDS=0.25 # Parallel STT queue workers. Increase to 2 when STT inference is slower than # incoming audio windows and the GPU has spare compute. STT_TRANSCRIBE_WORKERS=2 STT_TRANSCRIBE_QUEUE_SIZE=8 STT_MODEL_WORKERS=2 # Transcript emit batching. STT may infer more often than it emits to PolyTalk. # Increase these values if live transcript/translation/TTS chunks are too small. STT_EMIT_MIN_CHARS=120 STT_EMIT_INTERVAL_SECONDS=4.5 # Flush the current speech window after this much trailing silence, even if the # normal stream window or emit thresholds have not been reached. Set 0 to disable. STT_PAUSE_FLUSH_SECONDS=1.2 # Flush the current speech window if audio chunks stop arriving after speech. STT_IDLE_FLUSH_SECONDS=3.0 # Keep a small amount of audio before first detected speech, but do not let # leading tab-share silence fill the first STT window. STT_LEADING_SILENCE_PREROLL_SECONDS=0.2 # Silence/hallucination guards for streaming STT. These balanced defaults work # well for typical microphone input: raise RMS/no-speech strictness if Whisper # hallucinates during silence; lower them if quiet speech is missed. STT_SILENCE_RMS_THRESHOLD=0.003 STT_NO_SPEECH_PROB_THRESHOLD=0.50 STT_LOG_PROB_THRESHOLD=-1.0 STT_MAX_CROSS_DELTA_WORD_REPEATS=6 # faster-whisper decoding/VAD knobs. Keep previous-text conditioning disabled # by default for streaming because it can repeat or invent text during silence. STT_VAD_FILTER=true STT_VAD_MIN_SILENCE_MS=500 STT_VAD_SPEECH_PAD_MS=200 STT_WORD_TIMESTAMPS=true STT_CONDITION_ON_PREVIOUS_TEXT=false STT_TEMPERATURE=0.0 # Optional domain/context prompt for Whisper, for example names or product terms. # STT_INITIAL_PROMPT= # ============================================================================ # WHISPER SERVICE CONFIGURATION (Points to local STT or external) # ============================================================================ # Base URL for Whisper API (defaults to local STT service in Docker) # For external service, use: https://whisper.your-domain.com WHISPER_BASE_URL=http://stt:8000 # WebSocket endpoint for streaming transcription (used by PolyTalk) WHISPER_WS_ENDPOINT=/v1/stream/transcriptions # Optional: API key for external Whisper API (e.g., OpenAI, custom deployment) # Set this if your Whisper service requires authentication # WHISPER_API_KEY=your-api-key-here # ============================================================================ # TRANSLATION SERVICE (AI Translation) # ============================================================================ # Translation API format: openai_chat, openai_responses, anthropic_messages, # or gemini_generate_content. TRANSLATION_API_FORMAT=openai_chat # Base URL and endpoint for Translation API. Use your self-hosted AI server # URL here, or an OpenAI-compatible provider URL. TRANSLATION_BASE_URL=https://ai.example.com TRANSLATION_ENDPOINT=/v1/chat/completions # API key for Translation service TRANSLATION_API_KEY=your_translation_api_key_here # AI model to use for translation. For self-hosted translation, use models such # as qwen3-8b, TranslateGama, or other open-source/open-weight models supported # by your model server. TRANSLATION_MODEL=qwen3-8b # Optional second translation provider. Add more named providers in # config/config.yaml using the same provider fields when needed. TRANSLATEGAMMA_BASE_URL=https://ai.example.com TRANSLATEGAMMA_ENDPOINT=/v1/chat/completions TRANSLATEGAMMA_API_FORMAT=openai_chat TRANSLATEGAMMA_API_KEY=your_translategamma_api_key_here TRANSLATEGAMMA_MODEL=translategamma # Maximum translation output tokens. Keep this bounded for live streaming, but # allow enough room for Indic-script targets and longer sentence buffers. TRANSLATION_MAX_TOKENS=240 # ============================================================================ # VISUAL CONTEXT SERVICE (Shared Tab/Page Screenshot) # ============================================================================ # Enable one-time shared tab/page screenshot summarization when tab audio # sharing starts. The summary is used as translation context only. VISUAL_CONTEXT_ENABLED=false # Keep mock mode enabled for local setup. For real visual context, set this to # false and configure a vision-capable provider below. VISUAL_CONTEXT_MOCK_MODE=true # Visual context can use a separate vision-capable provider/model, or mirror the # translation provider if it supports image inputs. VISUAL_CONTEXT_BASE_URL=https://ai.example.com VISUAL_CONTEXT_ENDPOINT=/v1/chat/completions VISUAL_CONTEXT_API_FORMAT=openai_chat VISUAL_CONTEXT_API_KEY=your_visual_context_api_key_here VISUAL_CONTEXT_MODEL=gpt-4o-mini # Maximum output tokens for the compact screenshot summary. VISUAL_CONTEXT_MAX_TOKENS=300 # ============================================================================ # TTS SERVICE (Local Text-to-Speech with Piper) # ============================================================================ # Piper model to use (voice model name in tts/voices directory) TTS_MODEL=en_GB-jenny_dioco-medium # Base URL for TTS API (local Piper service in Docker) # For external service, use: https://tts.your-domain.com TTS_BASE_URL=http://tts:5000 # Supertonic TTS is used for Japanese and Korean. First startup downloads # model assets into the supertonic_data Docker volume. SUPERTONIC_TTS_BASE_URL=http://supertonic-tts:7788 SUPERTONIC_TTS_VOICE=F1 SUPERTONIC_TTS_JA_VOICE=F1 SUPERTONIC_TTS_KO_VOICE=F1 SUPERTONIC_TTS_STEPS=8 SUPERTONIC_TTS_SPEED=1.00 # ============================================================================ # APPLICATION SETTINGS # ============================================================================ # Host to bind the application (0.0.0.0 for all interfaces) APP_HOST=0.0.0.0 # Port to run the application APP_PORT=9000 # Enable debug mode (set to false for production) APP_DEBUG=true # Comma-separated browser origins allowed to call the app. # Use the exact HTTPS origin in production, for example: # ALLOWED_ORIGINS=https://polytalk.example.com ALLOWED_ORIGINS=http://localhost:9000,http://127.0.0.1:9000 # Translate partial speech after this many buffered characters or seconds. # Lower values reduce latency; higher values improve context and quality. TRANSLATION_FLUSH_CHARS=300 TRANSLATION_FLUSH_SECONDS=5.0 TRANSLATION_FLUSH_MIN_CHARS=120 # Maximum characters for custom translation instructions (user-provided # translation guidance sent via WebSocket or query parameter). CUSTOM_INSTRUCTION_MAX_CHARS=250