pediatric-ai-scribe-v3/docs/speech.md

38 lines
1.7 KiB
Markdown

# Speech: STT, TTS, Audio Backup
## Transcription
`POST /api/transcribe` accepts `multipart/form-data` with one audio file up to 25 MB. Server STT is routed through LiteLLM.
Set `TRANSCRIBE_PROVIDER=litellm`, `LITELLM_API_BASE`, and `LITELLM_STT_MODEL`. Auto mode also uses LiteLLM when the gateway is configured.
| Provider | Notes | HIPAA posture |
|---|---|---|
| LiteLLM | Sends audio through the configured LiteLLM `/audio/transcriptions` backend. | Depends on the selected upstream. |
Browser Whisper and browser-local Whisper workers are not part of the runtime. Do not add browser model downloads or Transformers.js STT back into the public app.
## Web Speech Preview
Browser-native Web Speech can show interim text when the user explicitly enables it. It is browser/vendor dependent, may send audio to browser-provider cloud services, and should not be treated as the final clinical transcript.
## Text To Speech
`POST /api/text-to-speech` returns audio from LiteLLM `/audio/speech`. The `X-TTS-Provider` response header identifies the LiteLLM model used. Requests are limited to 5000 characters.
| Provider | Notes |
|---|---|
| LiteLLM | Uses `LITELLM_TTS_MODEL` and `LITELLM_TTS_VOICE`. |
The admin/user voice pickers read available LiteLLM-compatible voices from `LITELLM_TTS_VOICES`.
## Audio Backup
Failed transcription submissions can be stored for retry instead of being silently lost.
- Audio backups are compressed and encrypted before storage.
- Backups expire automatically.
- The Settings audio backup UI can retry or delete saved items.
- Browser fallback storage is used only when the server cannot save the failed audio.
Treat audio backups as sensitive clinical data even when encrypted.