Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cd6b29a
docs: add OpenMAIC TTS static audit
MahammadWahab540 Jul 4, 2026
a605c39
Validate OpenAI speech request inputs
MahammadWahab540 Jul 4, 2026
4f7d216
Preserve HTTP exceptions in speech endpoint
MahammadWahab540 Jul 4, 2026
a31aa77
Add CPU Dockerfile for Railway
MahammadWahab540 Jul 4, 2026
e069332
Honor PORT environment variable for server port
MahammadWahab540 Jul 4, 2026
0248f96
Gate browser auto-open behind explicit flag
MahammadWahab540 Jul 4, 2026
a107c73
Bake default model into CPU image
MahammadWahab540 Jul 4, 2026
4b155ab
Configure ONNX session options
MahammadWahab540 Jul 4, 2026
733cf0d
Configure POSIX eSpeak library discovery
MahammadWahab540 Jul 4, 2026
d8de5eb
Remove PyTorch dependency from CPU provider detection
MahammadWahab540 Jul 4, 2026
b41d1b6
Add TTS warmup health state
MahammadWahab540 Jul 4, 2026
2377419
Add health endpoint
MahammadWahab540 Jul 4, 2026
ea339e1
Stream OpenAI WAV speech chunks
MahammadWahab540 Jul 4, 2026
49a2b5e
Add streaming mode to custom TTS endpoint
MahammadWahab540 Jul 4, 2026
8891359
Add OpenAI speech performance logging
MahammadWahab540 Jul 4, 2026
daa6a20
Merge pull request #15 from MahammadWahab540/codex/update-server.py-f…
MahammadWahab540 Jul 4, 2026
814df27
Merge pull request #1 from MahammadWahab540/codex/run-static-audit-fo…
MahammadWahab540 Jul 4, 2026
f7461f8
Merge pull request #2 from MahammadWahab540/codex/update-openaispeech…
MahammadWahab540 Jul 4, 2026
e2c625a
Merge branch 'main' into codex/update-error-handling-in-server.py
MahammadWahab540 Jul 4, 2026
1b13148
Merge pull request #3 from MahammadWahab540/codex/update-error-handli…
MahammadWahab540 Jul 4, 2026
b881be7
Merge pull request #4 from MahammadWahab540/codex/create-dockerfile.c…
MahammadWahab540 Jul 4, 2026
0bf6483
Merge pull request #5 from MahammadWahab540/codex/update-get_port-to-…
MahammadWahab540 Jul 4, 2026
bd27fd7
Merge branch 'main' into codex/update-server.py-to-conditionally-open…
MahammadWahab540 Jul 4, 2026
7f897e4
Merge pull request #6 from MahammadWahab540/codex/update-server.py-to…
MahammadWahab540 Jul 4, 2026
85a991a
Merge branch 'main' into codex/add-model-download-script-and-docker-s…
MahammadWahab540 Jul 4, 2026
cb90830
Merge pull request #7 from MahammadWahab540/codex/add-model-download-…
MahammadWahab540 Jul 4, 2026
09f75d2
Merge pull request #8 from MahammadWahab540/codex/update-onnx-session…
MahammadWahab540 Jul 4, 2026
932a9f5
Merge branch 'main' into codex/update-engine.py-for-espeak-ng-library…
MahammadWahab540 Jul 4, 2026
c90d99a
Merge pull request #9 from MahammadWahab540/codex/update-engine.py-fo…
MahammadWahab540 Jul 4, 2026
a2f19ef
Merge pull request #10 from MahammadWahab540/codex/refactor-configura…
MahammadWahab540 Jul 4, 2026
e964195
Merge branch 'main' into codex/add-warmup-function-in-engine.py
MahammadWahab540 Jul 4, 2026
996fa45
Merge pull request #11 from MahammadWahab540/codex/add-warmup-functio…
MahammadWahab540 Jul 4, 2026
3775951
Merge pull request #12 from MahammadWahab540/codex/add-health-check-e…
MahammadWahab540 Jul 4, 2026
00ffe51
Merge branch 'main' into codex/update-openai_speech_endpoint-for-text…
MahammadWahab540 Jul 4, 2026
781f4e0
Merge pull request #13 from MahammadWahab540/codex/update-openai_spee…
MahammadWahab540 Jul 4, 2026
25f4477
Merge pull request #14 from MahammadWahab540/codex/update-custom_tts_…
MahammadWahab540 Jul 4, 2026
6456123
Fix lazy imports and apply security/config updates for PR16
google-labs-jules[bot] Jul 6, 2026
2f4eb2f
Harden PR17: safe-by-default security, fix WAV streaming, reconcile M…
Jul 7, 2026
b1ec075
Fix multi-chunk WAV truncation: concatenate chunks and encode one val…
Jul 7, 2026
967b58e
Fix PR17 P0 defaults, auth logic, streaming WAV header, CORS, and cle…
google-labs-jules[bot] Jul 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
software-properties-common \
espeak-ng \
libespeak-ng1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
28 changes: 28 additions & 0 deletions Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/app/hf_cache

WORKDIR /app

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libsndfile1 \
ffmpeg \
espeak-ng \
libespeak-ng1 \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN python -m pip install --upgrade pip \
&& python -m pip install -r requirements.txt

COPY . .

RUN mkdir -p model_cache outputs logs hf_cache

EXPOSE 8005

CMD ["python", "server.py"]
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ The first time you start the server, it will automatically download the default
python server.py
```

3. The server will start and automatically open the Web UI in your default browser.
3. Open the Web UI in your browser. Browser auto-open is disabled by default so hosted or containerized deployments do not launch a browser. For local UI development, set `OPEN_BROWSER=true` or `server.open_browser: true`.
* **Web UI:** `http://localhost:8005`
* **API Docs:** `http://localhost:8005/docs`

Expand Down Expand Up @@ -480,6 +480,10 @@ Use this for drop-in compatibility with scripts expecting OpenAI's TTS API struc
"speed": 0.9
}
```
* **Latency check:** WAV responses for medium/long text stream sentence chunks as they are generated. MP3 and Opus may still use a buffered compatibility path.
```bash
curl -s -o /tmp/out.wav -w "TTFB=%{time_starttransfer}s TOTAL=%{time_total}s STATUS=%{http_code}\n" -X POST "$BASE_URL/v1/audio/speech" -H "Content-Type: application/json" -d '{"model":"kitten-tts-nano-0.1","input":"Welcome to Pathwisse","voice":"expr-voice-2-f","response_format":"wav"}'
```

### Model Management Endpoints

Expand Down Expand Up @@ -529,3 +533,27 @@ This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) f
## 🤝 Contributing

Contributions, issues, and feature requests are welcome! Please feel free to open an issue or submit a pull request.


### API Authentication and Security Defaults
For safe deployment, the following security defaults are enabled:
- `ENABLE_WEB_UI` is `false` by default.
- `ENABLE_MANAGEMENT_ENDPOINTS` is `false` by default.
- API endpoints (`/tts`, `/api/tts/speak`, `/v1/audio/speech`, `/api/unload`, etc) require a configured `TTS_API_KEY`. If it is unset, these endpoints fail securely.

Provide your configured key via `Authorization: Bearer <your_api_key>` or `X-API-Key: <your_api_key>`.
Only `/health` and `/api/tts/health` are public without auth.

### CORS Configuration
CORS origins should be specified via the `ALLOWED_ORIGINS` environment variable (comma-separated, e.g. `http://localhost:3000,http://localhost:5173`). Wildcard `*` origins are no longer permitted with credentials in production.

### MP3 Support
To ensure compatibility in lightweight server environments (like Railway), MP3 generation is **intentionally unsupported** in this deployment. Please request `wav` (default) or `opus`.

The `/tts` and `/api/tts/speak` endpoints, as well as the OpenAI compatible endpoint `/v1/audio/speech`, now require authentication via an API Key when `TTS_API_KEY` environment variable is set.
Provide the key in the `Authorization` header:
`Authorization: Bearer <your_api_key>`

### Dependency Footprint Note (PR #16)
The CPU image size is significantly large (~2.5GB+) because `misaki[en]>=0.9.4` automatically pulls `spacy-curated-transformers` and `torch`. This violates the lightweight footprint requirement for small Railway instances.
*Recommendation for future:* Suggest moving to a lighter G2P/phonemizer pipeline, such as `gruut` or `phonemizer` with standard `espeak-ng` directly without transformer models to keep the image size small.
Loading