vocal-api 0.3.8__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {vocal_api-0.3.8 → vocal_api-0.4.0}/.gitignore +1 -2
  2. {vocal_api-0.3.8 → vocal_api-0.4.0}/MANIFEST.in +4 -4
  3. {vocal_api-0.3.8 → vocal_api-0.4.0}/PKG-INFO +7 -7
  4. {vocal_api-0.3.8 → vocal_api-0.4.0}/pyproject.toml +6 -6
  5. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/__init__.py +9 -9
  6. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/config.py +3 -0
  7. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/main.py +60 -9
  8. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/models/model.py +24 -4
  9. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/routes/__init__.py +2 -0
  10. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/routes/models.py +17 -15
  11. vocal_api-0.4.0/vocal_api/routes/realtime.py +745 -0
  12. vocal_api-0.4.0/vocal_api/routes/settings.py +185 -0
  13. vocal_api-0.4.0/vocal_api/routes/stream.py +300 -0
  14. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/routes/system.py +16 -16
  15. vocal_api-0.4.0/vocal_api/routes/transcription.py +139 -0
  16. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/routes/tts.py +13 -2
  17. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/services/__init__.py +9 -9
  18. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/services/model_service.py +6 -0
  19. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/services/transcription_service.py +50 -21
  20. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/services/tts_service.py +113 -16
  21. vocal_api-0.4.0/vocal_api/webui/app.css +472 -0
  22. vocal_api-0.4.0/vocal_api/webui/app.html +96 -0
  23. vocal_api-0.4.0/vocal_api/webui/design.md +137 -0
  24. vocal_api-0.4.0/vocal_api/webui/index.html +570 -0
  25. vocal_api-0.4.0/vocal_api/webui/js/api.js +155 -0
  26. vocal_api-0.4.0/vocal_api/webui/js/app.js +168 -0
  27. vocal_api-0.4.0/vocal_api/webui/js/audio.js +289 -0
  28. vocal_api-0.4.0/vocal_api/webui/js/connection.js +128 -0
  29. vocal_api-0.4.0/vocal_api/webui/js/icons.js +50 -0
  30. vocal_api-0.4.0/vocal_api/webui/js/mic.js +132 -0
  31. vocal_api-0.4.0/vocal_api/webui/js/pcm-worklet.js +11 -0
  32. vocal_api-0.4.0/vocal_api/webui/js/store.js +81 -0
  33. vocal_api-0.4.0/vocal_api/webui/js/ui.js +190 -0
  34. vocal_api-0.4.0/vocal_api/webui/js/views/agent.js +417 -0
  35. vocal_api-0.4.0/vocal_api/webui/js/views/clone.js +293 -0
  36. vocal_api-0.4.0/vocal_api/webui/js/views/dashboard.js +163 -0
  37. vocal_api-0.4.0/vocal_api/webui/js/views/live.js +240 -0
  38. vocal_api-0.4.0/vocal_api/webui/js/views/models.js +290 -0
  39. vocal_api-0.4.0/vocal_api/webui/js/views/settings.js +189 -0
  40. vocal_api-0.4.0/vocal_api/webui/js/views/stt.js +344 -0
  41. vocal_api-0.4.0/vocal_api/webui/js/views/tts.js +230 -0
  42. vocal_api-0.4.0/vocal_api/webui/og.svg +33 -0
  43. vocal_api-0.4.0/vocal_api/webui/theme.css +585 -0
  44. vocal_api-0.3.8/vocal_api/routes/realtime.py +0 -399
  45. vocal_api-0.3.8/vocal_api/routes/stream.py +0 -216
  46. vocal_api-0.3.8/vocal_api/routes/transcription.py +0 -83
  47. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/dependencies.py +0 -0
  48. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/models/__init__.py +0 -0
  49. {vocal_api-0.3.8 → vocal_api-0.4.0}/vocal_api/models/transcription.py +0 -0
@@ -27,8 +27,7 @@ venv/
27
27
  ENV/
28
28
  env/
29
29
 
30
- # UV
31
- uv.lock
30
+ # UV (uv.lock is committed for reproducible builds)
32
31
 
33
32
  # IDE
34
33
  .vscode/
@@ -1,4 +1,4 @@
1
- include ../../../README.md
2
- include ../../../LICENSE
3
- recursive-include vocal_api *.py
4
- recursive-include vocal_api/models *.py
1
+ include ../../../README.md
2
+ include ../../../LICENSE
3
+ recursive-include vocal_api *.py
4
+ recursive-include vocal_api/models *.py
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: vocal-api
3
- Version: 0.3.8
3
+ Version: 0.4.0
4
4
  Summary: FastAPI server for Vocal - Ollama-style Voice Model Management
5
5
  Project-URL: Homepage, https://github.com/niradler/vocal
6
6
  Project-URL: Documentation, https://github.com/niradler/vocal/tree/master/docs
@@ -19,8 +19,8 @@ Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
20
20
  Requires-Python: >=3.11
21
21
  Requires-Dist: aiofiles>=25.1.0
22
- Requires-Dist: fastapi>=0.135.1
23
- Requires-Dist: pydantic>=2.12.5
24
- Requires-Dist: python-multipart>=0.0.22
25
- Requires-Dist: uvicorn[standard]>=0.41.0
26
- Requires-Dist: vocal-core>=0.3.8
22
+ Requires-Dist: fastapi>=0.163.2
23
+ Requires-Dist: pydantic>=2.14.3
24
+ Requires-Dist: python-multipart>=0.0.34
25
+ Requires-Dist: uvicorn[standard]>=0.54.0
26
+ Requires-Dist: vocal-core>=0.4.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "vocal-api"
3
- version = "0.3.8"
3
+ version = "0.4.0"
4
4
  description = "FastAPI server for Vocal - Ollama-style Voice Model Management"
5
5
  requires-python = ">=3.11"
6
6
  license = { text = "SSPL-1.0" }
@@ -19,11 +19,11 @@ classifiers = [
19
19
  "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
20
20
  ]
21
21
  dependencies = [
22
- "fastapi>=0.135.1",
23
- "uvicorn[standard]>=0.41.0",
24
- "pydantic>=2.12.5",
25
- "python-multipart>=0.0.22",
26
- "vocal-core>=0.3.8",
22
+ "fastapi>=0.163.2",
23
+ "uvicorn[standard]>=0.54.0",
24
+ "pydantic>=2.14.3",
25
+ "python-multipart>=0.0.34",
26
+ "vocal-core>=0.4.0",
27
27
  "aiofiles>=25.1.0",
28
28
  ]
29
29
 
@@ -1,9 +1,9 @@
1
- from .config import settings
2
- from .main import app
3
-
4
- __version__ = settings.VERSION
5
-
6
- __all__ = [
7
- "app",
8
- "settings",
9
- ]
1
+ from .config import settings
2
+ from .main import app
3
+
4
+ __version__ = settings.VERSION
5
+
6
+ __all__ = [
7
+ "app",
8
+ "settings",
9
+ ]
@@ -16,6 +16,9 @@ class Settings(BaseSettings):
16
16
  DEBUG: bool = False
17
17
 
18
18
  CORS_ORIGINS: list[str] = ["*"]
19
+ # Allow browser requests from public origins (e.g. the GitHub Pages
20
+ # console) to this local server — Chrome's Private Network Access.
21
+ CORS_ALLOW_PRIVATE_NETWORK: bool = True
19
22
 
20
23
  MAX_UPLOAD_SIZE: int = 25 * 1024 * 1024
21
24
 
@@ -17,22 +17,37 @@ if sys.platform == "win32":
17
17
  del ctypes
18
18
 
19
19
  from contextlib import asynccontextmanager
20
+ from pathlib import Path
20
21
 
21
- from fastapi import FastAPI
22
+ from fastapi import FastAPI, Request
22
23
  from fastapi.middleware.cors import CORSMiddleware
23
24
  from fastapi.openapi.utils import get_openapi
25
+ from fastapi.responses import FileResponse, JSONResponse
26
+ from fastapi.staticfiles import StaticFiles
24
27
 
25
28
  from vocal_core.config import vocal_settings
26
29
  from vocal_core.logging import setup_logging
27
30
 
28
31
  from .config import settings
29
32
  from .dependencies import get_transcription_service, get_tts_service
30
- from .routes import models_router, realtime_router, stream_router, system_router, transcription_router, tts_router
33
+ from .routes import (
34
+ models_router,
35
+ realtime_router,
36
+ settings_router,
37
+ stream_router,
38
+ system_router,
39
+ transcription_router,
40
+ tts_router,
41
+ )
42
+ from .routes.settings import load_persisted_settings
43
+
44
+ WEBUI_DIR = Path(__file__).parent / "webui"
31
45
 
32
46
 
33
47
  @asynccontextmanager
34
48
  async def lifespan(app: FastAPI):
35
49
  """Initialize services and start background tasks"""
50
+ load_persisted_settings()
36
51
  setup_logging(level=vocal_settings.LOG_LEVEL, fmt=vocal_settings.LOG_FORMAT)
37
52
 
38
53
  try:
@@ -68,24 +83,54 @@ app.add_middleware(
68
83
  allow_credentials=True,
69
84
  allow_methods=["*"],
70
85
  allow_headers=["*"],
86
+ # Lets a publicly hosted console (GitHub Pages) reach this local server
87
+ # from the browser (Chrome Private Network Access preflight).
88
+ allow_private_network=settings.CORS_ALLOW_PRIVATE_NETWORK,
71
89
  )
72
90
 
73
91
  app.include_router(transcription_router)
74
92
  app.include_router(models_router)
75
93
  app.include_router(tts_router)
76
94
  app.include_router(system_router)
95
+ app.include_router(settings_router)
77
96
  app.include_router(stream_router)
78
97
  app.include_router(realtime_router)
79
98
 
99
+ # Web UI static assets (landing page + console). Served under /static so the
100
+ # HTML entry points below can reference shared CSS/JS without a build step.
101
+ app.mount("/static", StaticFiles(directory=WEBUI_DIR), name="static")
102
+
80
103
 
81
104
  @app.get("/", tags=["health"])
82
- async def root():
83
- """API health check"""
84
- return {
85
- "status": "ok",
86
- "message": "Vocal API - Ollama-style voice model management",
87
- "version": settings.VERSION,
88
- }
105
+ async def root(request: Request):
106
+ """API health check for clients; landing page for browsers.
107
+
108
+ Browsers send ``Accept: text/html`` and get the landing page. API clients
109
+ (SDK, curl, health checks) send ``*/*`` or ``application/json`` and keep the
110
+ original JSON contract.
111
+ """
112
+ accept = request.headers.get("accept", "")
113
+ if "text/html" in accept:
114
+ return FileResponse(WEBUI_DIR / "index.html", media_type="text/html", headers={"Vary": "Accept"})
115
+ return JSONResponse(
116
+ {
117
+ "status": "ok",
118
+ "message": "Vocal API - Ollama-style voice model management",
119
+ "version": settings.VERSION,
120
+ }
121
+ )
122
+
123
+
124
+ @app.get("/welcome", include_in_schema=False)
125
+ async def welcome():
126
+ """Landing page (explicit route)."""
127
+ return FileResponse(WEBUI_DIR / "index.html", media_type="text/html")
128
+
129
+
130
+ @app.get("/ui", include_in_schema=False)
131
+ async def console():
132
+ """Web console — manage models, run speech pipelines, configure Vocal."""
133
+ return FileResponse(WEBUI_DIR / "app.html", media_type="text/html")
89
134
 
90
135
 
91
136
  @app.get("/health", tags=["health"])
@@ -113,3 +158,9 @@ def custom_openapi():
113
158
 
114
159
 
115
160
  app.openapi = custom_openapi
161
+
162
+ # Fallback static mount: serves webui assets at root-level paths (/theme.css,
163
+ # /js/app.js, ...) so the HTML entry points can use relative URLs. The same
164
+ # files then also work under a GitHub Pages subpath. Mounted LAST so every API
165
+ # route above always wins.
166
+ app.mount("/", StaticFiles(directory=WEBUI_DIR), name="webui")
@@ -25,13 +25,12 @@ class ModelBackend(str, Enum):
25
25
  FASTER_QWEN3_TTS = "faster_qwen3_tts"
26
26
  PIPER = "piper"
27
27
  CHATTERBOX = "chatterbox"
28
- XTTS = "xtts"
29
- FISH_SPEECH = "fish_speech"
30
- ORPHEUS = "orpheus"
31
- DIA = "dia"
32
28
  VOXTRAL_STT = "voxtral_stt"
33
29
  VOXTRAL_TTS = "voxtral_tts"
34
30
  OMNIVOICE = "omnivoice"
31
+ SUPERTONIC = "supertonic"
32
+ VOXCPM = "voxcpm"
33
+ PHONON = "phonon"
35
34
  CUSTOM = "custom"
36
35
 
37
36
 
@@ -50,6 +49,21 @@ class ModelTask(str, Enum):
50
49
  TTS = "tts"
51
50
 
52
51
 
52
+ class ModelRuntime(str, Enum):
53
+ """How a model is executed"""
54
+
55
+ IN_PROCESS = "in_process"
56
+ EXTERNAL = "external"
57
+
58
+
59
+ class ModelMaintenanceStatus(str, Enum):
60
+ """Upstream maintenance state of the model"""
61
+
62
+ ACTIVE = "active"
63
+ RETIRED = "retired"
64
+ DEPRECATED = "deprecated"
65
+
66
+
53
67
  class ModelInfo(BaseModel):
54
68
  """Model information schema"""
55
69
 
@@ -67,6 +81,10 @@ class ModelInfo(BaseModel):
67
81
  status: ModelStatus = Field(description="Current model status")
68
82
  source_url: HttpUrl | None = None
69
83
  license: str | None = None
84
+ commercial_use: bool | None = Field(default=None, description="Whether the model weights license permits commercial use")
85
+ runtime: ModelRuntime = Field(default=ModelRuntime.IN_PROCESS, description="'in_process' when Vocal runs the model itself, 'external' when it needs an out-of-process engine")
86
+ runtime_note: str | None = Field(default=None, description="Engine/serving requirement outside Vocal's bundled adapters, if any")
87
+ maintenance_status: ModelMaintenanceStatus = Field(default=ModelMaintenanceStatus.ACTIVE, description="Upstream maintenance state (active/retired/deprecated)")
70
88
  recommended_vram: str | None = None
71
89
  task: ModelTask = Field(description="Task type")
72
90
  local_path: str | None = None
@@ -79,6 +97,7 @@ class ModelInfo(BaseModel):
79
97
  sha: str | None = Field(default=None, description="Git commit SHA")
80
98
  files: list[dict] | None = Field(default=None, description="List of model files")
81
99
  supports_streaming: bool = Field(default=False, description="Whether the model supports true streaming output")
100
+ supports_live_streaming: bool = Field(default=False, description="Whether the model supports true chunk-by-chunk live audio streaming")
82
101
  supports_voice_list: bool = Field(default=False, description="Whether the model exposes selectable voices")
83
102
  supports_voice_clone: bool = Field(default=False, description="Whether the model supports reference-audio voice cloning")
84
103
  supports_voice_design: bool = Field(default=False, description="Whether the model supports prompt/instruction-based voice design")
@@ -87,6 +106,7 @@ class ModelInfo(BaseModel):
87
106
  clone_mode: str | None = Field(default=None, description="How /v1/audio/clone works for this model")
88
107
  reference_audio_min_seconds: float | None = Field(default=None, description="Recommended minimum reference audio length for cloning")
89
108
  reference_audio_max_seconds: float | None = Field(default=None, description="Recommended maximum reference audio length for cloning")
109
+ output_formats: list[str] = Field(default_factory=list, description="Audio formats /v1/audio/speech accepts for this model (empty for STT)")
90
110
 
91
111
 
92
112
  class ModelListResponse(BaseModel):
@@ -1,5 +1,6 @@
1
1
  from .models import router as models_router
2
2
  from .realtime import router as realtime_router
3
+ from .settings import router as settings_router
3
4
  from .stream import router as stream_router
4
5
  from .system import router as system_router
5
6
  from .transcription import router as transcription_router
@@ -10,6 +11,7 @@ __all__ = [
10
11
  "models_router",
11
12
  "tts_router",
12
13
  "system_router",
14
+ "settings_router",
13
15
  "stream_router",
14
16
  "realtime_router",
15
17
  ]
@@ -46,21 +46,6 @@ async def list_catalog(
46
46
  return ModelListResponse(models=models, total=len(models))
47
47
 
48
48
 
49
- @router.get(
50
- "/{model_id:path}",
51
- response_model=ModelInfo,
52
- response_model_exclude_none=True,
53
- summary="Get model info",
54
- description="Get detailed information about a specific model",
55
- )
56
- async def get_model(model_id: str, service: ModelService = Depends(get_model_service)) -> ModelInfo:
57
- """Get detailed model information"""
58
- model = await service.get_model(model_id)
59
- if not model:
60
- raise HTTPException(404, f"Model {model_id} not found")
61
- return model
62
-
63
-
64
49
  @router.post(
65
50
  "/{model_id:path}/download",
66
51
  response_model=ModelDownloadProgress,
@@ -128,6 +113,23 @@ async def get_download_status(model_id: str, service: ModelService = Depends(get
128
113
  return status
129
114
 
130
115
 
116
+ # NOTE: the greedy {model_id:path} routes must be declared AFTER the specific
117
+ # /download and /download/status suffixes, or they swallow those paths whole.
118
+ @router.get(
119
+ "/{model_id:path}",
120
+ response_model=ModelInfo,
121
+ response_model_exclude_none=True,
122
+ summary="Get model info",
123
+ description="Get detailed information about a specific model",
124
+ )
125
+ async def get_model(model_id: str, service: ModelService = Depends(get_model_service)) -> ModelInfo:
126
+ """Get detailed model information"""
127
+ model = await service.get_model(model_id)
128
+ if not model:
129
+ raise HTTPException(404, f"Model {model_id} not found")
130
+ return model
131
+
132
+
131
133
  @router.delete("/{model_id:path}", summary="Delete model", description="Remove a downloaded model")
132
134
  async def delete_model(model_id: str, service: ModelService = Depends(get_model_service)):
133
135
  """Delete a downloaded model"""