Introducing a new way to review your PRs.

Read the announcement

debpalash / voicestudio

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

View on GitHub

26 documents · Updated Nov 23, 2026

docs / backend-api-platform

Backend API platform

The Backend API platform is VoiceStudio's shared service boundary for local, remote, browser, desktop, phone, and programmatic clients. It turns client intent into speech, transcription, localization, model setup, agent, account-sync, project, and system results while keeping access, compute choice, progress, saved output, and provenance consistent.

Application boundary

Backend application

The backend application is the FastAPI service created by backend/main.py. It binds early so launchers can check readiness while heavy runtime preparation continues, then composes product routes after the runtime is prepared. Local launches, containers, and remote hosts use the same application contract.

The process owns one configured application-data directory at a time, and a lease prevents two backend processes from changing the same state. A short control route remains available during early startup so the desktop can mark an intentional shutdown before it must stop the process. This keeps startup and shutdown state honest for the next launch.

Startup has a guarded path. Health and startup-progress checks remain available while the runtime is prepared, but product routes stay closed until route composition, storage, and shared services are ready. Optional integrations such as MCP, telephony, and cloud settings sync do not prevent the core API from serving when they fail to start.

References: backend/main.py• L591-600 backend/main.py• L849-997 backend/main.py• L1607-1661

Client entrypoints

Clients use different transport shapes over the same backend boundary. First-party UIs use HTTP routes and streamed task updates. Capture and speech tools use direct audio routes or OpenAI-compatible audio routes. The standalone capture route supports fast, timed, and reference transcription for the UI, MCP tools, and command-line clients. Live dictation and live speech use WebSockets. Agent tools use MCP over HTTP or stdio. Phone providers use a narrow public gateway while call control stays private.

The OpenAI-compatible surface accepts common speech and transcription requests without a separate product path. It maps OpenAI model and voice aliases to active VoiceStudio engines or saved profiles, returns audio in the requested format, and keeps OpenAI-shaped errors beside VoiceStudio detail. The standalone capture route accepts uploaded audio and returns a transcript without creating a job.

References: backend/…/openai_compat.py• L1-27 backend/…/capture.py• L53-103 backend/…/capture.py• L124-165 backend/…/capture.py• L428-462 backend/…/capture_ws.py• L303-379 backend/…/speech_platform.py• L81-145 backend/main.py• L787-842

API composition

Route families

The API groups product capabilities into route families. Each family accepts client intent and passes it to shared services that own speech, recognition, translation, media, state, or compute work.

Product areaAPI roleRelated page
Speech creation and voicesCreate speech takes, render chapterized long-form audio, browse designed voice archetypes, manage reusable voices, preview voices, and convert speechSpeech generation and voice creation
Media localizationIngest video or audio, transcribe, translate, generate language tracks, fit timing, and export localized mediaMedia dubbing and long-form production
Speech inputTranscribe files and live audio with partial and final resultsTranscription and dictation
Speech platformPublish discoverable batch, stream, and agent transportsSpeech platform integration
Voice callsManage phone sessions and connect live voice, ASR, LLM, and TTS servicesVoice calls
LLM and agentsSelect providers and route feature-specific language-model skillsLLM and agent services
Model and computeInspect capability, install models, choose engines, and select local or remote capacityModel compute
Account cloud synchronizationSync selected account settings and renderer state between approved desktop devicesAccount cloud synchronization
Voice profiles and sharingStore reusable voice identities and exchange them as portable bundlesSpeech generation and voice creation
Product statePersist profiles, settings, projects, history, jobs, glossaries, exports, and events—
System accessReport readiness, hardware, logs, storage, model state, and diagnostics—

Shared request and response shapes preserve language, timing, voice, engine, and progress data as work moves between routes and services. Older sparse clients can use server defaults, while unsupported values fail before work starts.

References: backend/main.py• L787-842 backend/…/schemas.py• L13-244 backend/…/requests.py• L19-189

Speech creation

Speech creation turns text plus voice conditioning into a saved audio take. A client can choose a saved profile, a reference clip, a designed voice, or an engine preset. The request resolves the engine and execution target before model preparation, so remote work does not first load local weights.

The shared execution guard separates time spent waiting for capacity from time spent rendering. A saturated local pool returns a retryable result without starting work, while a render that starts receives a bounded execution budget. This keeps local, remote, streaming, and programmatic speech requests on the same capacity contract.

The same boundary supports chapterized long-form work. Clients can submit a script or a pre-built chapter and span plan, then receive progress while the service renders chapters and assembles the final audiobook or story output. Interrupted long-form work keeps enough durable job state to resume without the original script.

Finalization saves audio, applies provenance policy, records history, and emits product events. Streaming and OpenAI-compatible speech change delivery, not the saved-take contract.

References: backend/…/generation.py• L1963-2025 backend/…/generation.py• L2195-2262 backend/…/generation.py• L2461-2475 backend/…/generation.py• L2824-2949 backend/…/model_manager.py• L617-732 backend/…/model_manager.py• L808-1057

Voice profiles

Voice profiles give speech creation a durable identity that can be reused across takes and projects. A profile can represent a recorded voice clone or a designed voice, with its text, language, personality, portrait, reference audio, and optional locked take kept together.

The profile boundary validates and decodes new audio before it becomes active. It also keeps profile records and owned files aligned when a reference changes, a design preview is materialized, a consent recording is added, or a profile is removed. Consent records provenance for features that need it; ordinary local synthesis does not depend on that attestation.

Designed profiles keep their recipe and engine identity separate from a recorded clone reference. If a design has no sample yet, the first media request can materialize one through the selected engine without publishing audio from an old profile revision.

References: backend/…/profiles.py• L112-316 backend/…/profiles.py• L318-424 backend/…/profiles.py• L682-791 backend/…/profiles.py• L853-1091

Voice archetypes

Voice archetypes are a catalog of designed voice recipes that help a client choose a voice by use case and sound. A client can inspect the catalog without loading a model, hear a preview from a shared gallery or local cache, and save the recipe as a reusable design profile.

Preview delivery is separate from profile creation. A preview may use a trusted pre-rendered clip or a local render, while using an archetype stores the design choices without forcing synthesis at that time.

References: backend/…/archetypes.py• L441-532 backend/…/archetypes.py• L535-597 backend/…/archetypes.py• L600-642

Portable voice exchange

Portable voice exchange moves a voice identity between machines without exposing the source database layout. The legacy .omnivoice format and the newer .ovsvoice persona format carry profile metadata and usable audio as bounded bundles. Import creates server-named assets and a new local profile.

Clients can inspect a persona bundle without writing it. They can then import it, preserve a design recipe when present, and apply a real consent recording and text before treating the voice as verified. The local marketplace adds publish, browse, install, and remove actions for bundles stored on the machine or a shared drive.

References: backend/…/marketplace.py• L66-205 backend/…/marketplace.py• L236-341 backend/…/marketplace.py• L347-515 backend/…/personas.py• L52-111 backend/…/personas.py• L170-311 backend/…/personas.py• L350-390

Media localization

Media localization accepts a local video, an audio-only source, or a checked remote URL. It prepares a project, extracts usable speech and background material, then moves through transcription, translation, voice generation, timing, and export. Audio-only jobs reuse the same core pipeline while returning an audio container instead of muxing a video.

Preparation can reuse complete artifacts from an earlier job with the same source and separation mode. When it must process the source, it reports download, extraction, separation, scene, and thumbnail stages while keeping the job record and its files aligned. A failed background separation is exposed as a degraded result rather than silently presented as a full mix.

The preparation boundary returns a job and task immediately. Clients follow the task stream until the source is ready, then use the job state for language tracks, segment text, cancellation, and export. Export can select tracks, retain background audio, burn subtitles, or save audio-only output in a supported format.

References: backend/…/dub_core.py• L839-1029 backend/…/dub_generate.py• L1319-1399 backend/…/dub_export.py• L285-419 backend/…/dub_export.py• L735-859 backend/…/dub_pipeline.py• L353-413 backend/…/dub_pipeline.py• L580-755 backend/…/dub_pipeline.py• L1604-1675 backend/…/dub_pipeline.py• L1670-2145

Speech input

Speech input provides file transcription and live dictation as one product capability. File requests return recognized text with language, duration, timing, and engine data. Live requests send partial results during capture and final results at the end. OpenAI-compatible transcription adds translation to English and several response forms.

The ASR service presents a common contract across local engines, isolated engines, and compatible external recognition. It checks readiness before work and turns missing models, licence gates, timeouts, and unusable output into actionable client states. Capture can also apply text cleanup, optional LLM refinement, and optional speaker labels without changing the raw transcript contract.

References: backend/…/capture.py• L53-103 backend/…/capture.py• L329-462 backend/…/capture_ws.py• L303-379 backend/…/capture_ws.py• L873-1200 backend/…/openai_compat.py• L962-1162

Engine selection

Engine selection gives the settings and setup clients one view of speech, recognition, language-model, translation, and diarisation choices. The boundary reports the active engine, its model, availability, licence state, installation status, and the host route that will run it.

An administrator can select only a known and usable backend. A hard hardware mismatch is rejected instead of becoming an invisible CPU fallback. A slower CPU route can remain selectable when the engine supports it. Health checks and bounded self-tests let the client separate dependency readiness from real synthesis output.

References: backend/…/engines.py• L41-117 backend/…/engines.py• L141-177 backend/…/engines.py• L190-373 backend/…/engines.py• L575-790 backend/…/engines.py• L969-1169

Service boundaries

Routers describe client-facing intent. TTS, ASR, LLM, and translation adapters provide common engine contracts. Model management owns loading, release, capacity, and time budgets. State services persist product records and task events. The compute gateway chooses local or remote execution and validates remote results before completion.

The model boundary uses one guarded worker service for blocking inference. It sizes capacity from the host, reports queue saturation as retryable, and starts the execution clock only after a worker accepts the job. Progress heartbeats can extend a healthy model load or long render within a hard limit, while a silent or overlong job produces a bounded timeout and resets future submissions.

An engine can run in the main process, behind an isolated sidecar, or on a remote worker. The engine registry exposes availability, host routing, selection, installation, health, and self-test as one settings-facing contract. Cloud synchronization remains an optional boundary: its desktop router manages access while the cloud client and merge service own remote state.

References: backend/…/engines.py• L40-188 backend/…/workers.py• L46-173 backend/…/cloud_sync.py• L15-27 backend/…/model_manager.py• L242-358 backend/…/model_manager.py• L617-732 backend/…/model_manager.py• L762-1057 backend/…/tts_backend.py• L215-289 backend/…/asr_backend.py• L424-487

Task ownership

Long-running work has a live process owner and a durable history. The in-memory dispatcher runs queued work and serves listeners quickly, while the job store records state changes and streamed events so clients can reconnect and recover a truthful job list after a restart.

Cancellation stops future work when possible. If the process ends while work is active, startup marks that work as failed rather than presenting it as resumable. Completed artifacts remain separate from the process-local queue. Dubbing uses atomic state-and-history updates and withdrawal markers so a delete or clear-history action cannot be undone by a late ingest or render save.

References: backend/…/tasks.py• L48-58 backend/…/tasks.py• L89-132 backend/…/tasks.py• L134-223 backend/…/dub_pipeline.py• L512-689 backend/…/dub_export.py• L285-408 backend/…/batch.py• L57-169 backend/main.py• L1094-1101

Startup and lifecycle

Startup phases

Startup first makes the process observable and then prepares the runtime. The socket binds before heavy imports and route registration. A deferred build prepares configuration, model services, and route modules. Finalization adds routes and asset mounts. Database and background services start after that composition step.

The startup gate keeps product requests closed while this work runs. Health and startup-progress routes remain available and report starting or failed state. The startup watchdog records a thread dump when startup hangs. A crash sentinel distinguishes an unclean exit from an intentional shutdown, including a desktop shutdown request during deferred startup.

This diagram shows the path from process start to a usable client boundary.

flowchart TD
    A[Process starts] --> B[Bind server]
    B --> C[Expose health and startup progress]
    B --> D[Load environment and saved settings]
    D --> E[Prepare runtime and model services]
    E --> F[Register APIs and asset mounts]
    F --> G[Prepare database and shared services]
    G --> H[Mark backend ready]
    H --> I[Serve local remote and programmatic clients]

References: backend/main.py• L602-845 backend/main.py• L849-997 backend/main.py• L1077-1279 backend/main.py• L1387-1445

Runtime services

After readiness, the process keeps model, task, media, event, worker, telephony, cloud-sync, and optional integration services alive. It warms selected speech, recognition, and watermark services in the background without making those warm-ups part of the client-facing readiness contract. Cloud synchronization idles unless account state enables it. Shutdown stops deferred work and releases resources with bounded waits. A request that arrives during shutdown receives a retryable result rather than being reported as completed.

Process-local queues and live model state are runtime state. Durable job records and final artifacts survive when the process can persist them, but active GPU work is not presented as resumable after a restart.

References: backend/main.py• L1137-1279 backend/main.py• L1455-1603 backend/…/batch.py• L90-150

Durable state

The database is the durable record for settings, profiles, generation and dub history, jobs, task events, projects, glossaries, calls, exports, and remote-worker state. Managed application data holds generated audio, references, media work, caches, logs, project bundles, and crash evidence.

The platform treats database state and file assets as one product resource. Save, import, export, and deletion flows keep records and owned files aligned so a record does not point to an invalid or untrusted asset.

References: backend/…/schemas.py• L31-83 backend/…/profiles.py• L300-316 backend/…/projects.py• L17-92 backend/…/project_bundles.py• L369-495 backend/…/dub_export.py• L207-264

Configuration and storage

Runtime configuration

Configuration combines environment files, saved user environment settings, and persisted application settings. Startup reads discovered dotenv files and restores values saved by the desktop Settings flow. The effective result controls listeners, application data, model cache, mirrors, engines, providers, remote access, performance profiles, and work budgets.

The /api/settings boundary gives approved desktop clients one place to inspect and change runtime choices. It covers access tokens, compute and performance choices, model storage, mirrors, LLM providers and skills, compatible ASR endpoints, export behavior, and retention. Secret values are stored and reported through masked or status-only fields rather than returned to clients.

Settings distinguish the saved choice from the effective running choice. They also report restart needs and mask secrets. Performance profiles can tune speech and translation behavior while selecting only installed and compatible resources. LLM providers and skills can be enabled or routed per feature.

Configuration areaProduct effect
Application dataDurable home for the database, voices, media, jobs, outputs, and logs
Model cache and endpointModel availability, download source, and offline recovery
Network and sharingLocal, LAN, browser, and remote client reachability
Engine and provider choicesSpeech, recognition, translation, LLM, and diarization behavior
Performance and budgetsQuality, speed, capacity, and bounded failure behavior
Telephony and workersPhone access and selected remote execution targets

Some settings affect the running process at once. Others change the next launch because model libraries or cache locations are chosen before those libraries load. The settings API reports this boundary so a client does not treat a saved choice as active when a restart is required.

References: backend/main.py• L128-166 backend/main.py• L627-653 backend/…/settings.py• L33-169 backend/…/settings.py• L671-851 backend/…/settings.py• L1174-1232 backend/…/settings.py• L1464-1533 backend/…/settings.py• L1567-1613

Model setup

Model setup gives first-run and programmatic clients one view of host support, model availability, recommendations, download progress, and recovery. The same catalogue describes local inventory and the selected execution capacity.

The setup boundary checks disk headroom and usable model content. A partial cache is not treated as installed. Installation reports progress, supports cancellation and retry, and records a complete snapshot before the model becomes ready. The wizard also checks the host runtime, memory, accelerator, driver, and configured model endpoint so a client can distinguish a local hardware limit from a download problem.

References: backend/…/models.py• L24-54 backend/…/download.py• L404-429 backend/…/download.py• L433-535 backend/…/download.py• L598-1049 backend/…/wizard.py• L73-99 backend/…/wizard.py• L490-709

Persistent application state

The backend keeps product state in the configured application data area rather than in the source tree. Client-facing asset URLs point to server-owned output. Native save actions use a one-shot capability and remain separate from browser-facing artifact access.

Settings also expose storage reports, temporary-file cleanup, model-cache location, media-tool status, and external speech or LLM endpoint state. Changes that affect model loading can require a restart so the running process and its cache do not diverge.

References: backend/…/settings.py• L1046-1138 backend/…/settings.py• L1174-1232 backend/…/settings.py• L1319-1371 backend/…/settings.py• L1459-1519 backend/…/system.py• L370-429 backend/main.py• L1495-1504

Request protection

Access tiers

The platform separates local trust, consumption, administration, desktop access, and native filesystem access. Loopback clients can use local controls. Authenticated remote clients can consume or administer according to their credential. Share PINs and trusted networks grant consumption access only.

Server mode supports remote administration through an API key or short-lived admin session. Browser sessions add origin and CSRF checks. WebSockets use an appropriate ticket or remote credential. Native filesystem actions remain loopback-only. Account cloud synchronization requires both administration and a desktop caller. Call control can be granted to a paired authenticated session only when the call setting allows it. MCP requests delegated back into the application do not gain admin rights from their loopback-shaped peer; they need a proven admin credential.

References: backend/…/dependencies.py• L39-183 backend/…/dependencies.py• L211-332 backend/…/dependencies.py• L337-447 backend/…/dependencies.py• L450-494 backend/…/calls.py• L21-150 backend/…/cloud_sync.py• L12-27

Middleware pipeline

Middleware applies shared checks before route handlers run. The startup gate blocks work during partial startup. Network and bearer-key gates protect non-loopback access. Browser and CSRF rules protect approved browser clients. Route dependencies add stronger checks for administration, desktop actions, native paths, and consumption.

The backend marker identifies a real VoiceStudio backend to clients. Validation and unhandled-error handlers return bounded public detail while retaining local diagnostics. Pure ASGI middleware passes streaming responses through without buffering. The OpenAI-compatible router applies its own error shape only to /v1 handlers. Diagnostic access has a stricter admin gate than ordinary read-only discovery because logs and crash records can expose host details.

References: backend/main.py• L1525-1767 backend/main.py• L1770-2039 backend/…/dependencies.py• L238-319 backend/…/dependencies.py• L376-404 backend/…/openai_compat.py• L58-150

Client-facing protocols

Health and assets

Health routes form the readiness contract for launchers, containers, and remote clients. The health probe answers while heavy startup work runs and changes to ready only after the full application boundary is usable. The same process serves generated audio, voice assets, previews, project results, and the web UI after route composition completes.

The SPA mount is registered last so it cannot shadow an API route or a readiness endpoint. Responses carry a backend marker and expose enough setup state to explain unavailable features without returning secret values.

References: backend/main.py• L848-945 backend/main.py• L1480-1522 backend/main.py• L1864-1909

Streaming and live updates

Server-sent events and WebSockets carry progress, early audio, partial recognition, and call state. Task streams replay persisted events after reconnect, then attach to live updates when a task is still active. The sidebar event socket is a lighter invalidation channel: it tells the client which data to refetch and sends keepalives, but it does not replace task history. Keepalive messages prevent a quiet job from looking dead to a browser or proxy.

Speech preview can also use an NDJSON stream that sends start metadata, playable audio chunks, and a final saved-take record. Streaming changes delivery, not the saved result. Final speech, dubbing, batch, long-form, and call output still use their normal artifact, history, cache, and provenance rules.

References: backend/…/dub_export.py• L285-340 backend/…/dub_export.py• L343-408 backend/…/dub_export.py• L266-320 backend/…/generation.py• L2461-2475 backend/…/generation.py• L2574-2819 backend/…/generation.py• L2882-2929 backend/…/tts_stream.py• L274-501 backend/…/capture_ws.py• L303-379 backend/…/calls.py• L185-229 backend/…/events.py• L26-56 backend/…/tasks.py• L115-132

Speech platform discovery

The speech platform publishes a stable capability document so clients discover transports instead of hard-coding a desktop route. It describes batch transcription, streaming input framing, output event types, MCP access, and authentication.

Relative endpoint paths let the same document work on loopback, a remote compute host, or behind a reverse proxy. Native HTTP, OpenAI-compatible routes, and WebSocket dictation remain client choices over the same backend services.

References: backend/…/speech_platform.py• L18-145 backend/…/capture_ws.py• L73-168

Diagnostics and failure contracts

Failures use a shared classifier and response builder so local, remote, batch, streamed, and programmatic clients can explain the same class of problem. The builder guarantees a non-empty reason, adds a stable failure topic, user guidance, and a documentation URL when one exists, and preserves a sanitized diagnostic for support.

Malformed requests return bounded validation detail, binary request bodies are not echoed, and shutdown-related model loads return a retryable state rather than a crash report. Typed media failures expose stable codes and messages for cases such as a source with no audio track or an unreadable media file. Speech generation also distinguishes capacity saturation from an execution timeout, so clients can retry a request that never started without treating a running job as lost work.

Failure classification distinguishes resource, setup, network, media, and access problems. Sanitization removes terminal control codes, credential values, and absolute home paths before text reaches public fields or diagnostics. This keeps recovery advice useful without exposing private host data.

Technical diagnostic reports form a separate, explicit-consent path. They accept bounded typed facts rather than raw exception text, keep capture in memory before a worker persists it, and stop collection and delivery when consent is absent or withdrawn. This lets support receive useful failure patterns without making product requests depend on reporting.

References: backend/…/failure.py• L650-710 backend/…/failure.py• L1083-1152 backend/…/failure.py• L1384-1463 backend/…/generation.py• L2930-2997 backend/…/model_manager.py• L550-569 backend/…/model_manager.py• L940-1057 backend/main.py• L1700-1805 backend/main.py• L1808-1845 backend/…/diagnostic_reports.py• L1-5 backend/…/diagnostic_reports.py• L407-454 backend/…/diagnostic_reports.py• L984-1099 backend/…/diagnostic_reports.py• L1160-1235

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep route registration, static mounts, and the startup gate ordered so clients cannot reach a partial API or a frontend mount that shadows an API route.
  • Keep health, setup, startup-progress, backend-marker, shutdown-intent, and crash responses aligned with launcher behavior for starting, ready, failed, crashed, and shutting-down states.
  • Keep speech creation, voice profiles, media localization, live input, and OpenAI-compatible routes on the same engine, text, provenance, and asset contracts.
  • Keep profile records, reference files, locked takes, consent records, and design previews aligned through replacement, import, export, and deletion flows.
  • Keep archetype catalog identity, preview source status, cache behavior, and design-profile recipes aligned across voice-picker clients.
  • Keep .omnivoice compatibility, .ovsvoice schema fields, bundle inspection, consent verification, and server-named extracted assets aligned across portable voice clients.
  • Keep engine catalogue availability, hardware routing status, environment overrides, model selection, install paths, health checks, and self-test results consistent.
  • Keep one execution decision per request. Remote assignment must happen before local model preparation and must not create an unannounced local fallback.
  • Keep the shared generation budget, queue-wait budget, progress-heartbeat extension, retry-after value, and timeout classification aligned across classic, streamed, OpenAI-compatible, batch, dub, and preview synthesis.
  • Keep language-scoped text, voice bindings, timing plans, cache keys, and export selection aligned across translation, generation, and export.
  • Keep dubbing cache identity tied to source content and background-separation mode, and require complete artifacts before reuse.
  • Keep process-local queues distinct from durable jobs. A restart must not present active GPU work as resumable.
  • Keep task event sequence storage and live listener delivery aligned so reconnects replay history before receiving new updates.
  • Keep dub job withdrawal, in-memory eviction, SQLite writes, and late ingest or render completion atomic so deleted work cannot return to history.
  • Keep environment precedence, effective paths, provider state, restart indicators, secret masking, LLM skill routing, and performance-profile reconciliation aligned across startup, setup, system, and settings.
  • Keep cloud-sync allowlists, local mirror sequence numbers, renderer acknowledgement rules, device actions, and cloud error mapping aligned with the desktop and account services.
  • Keep access tiers separate. A share PIN or trusted network must not grant administration, desktop access, native filesystem access, or billable call control.
  • Keep failure topics, documentation links, stable codes, hints, and sanitized fields aligned when adding or changing a failure class.
  • Keep diagnostic consent, grant epochs, bounded report fields, private storage, and delivery state aligned when changing failure capture or support flows.
  • Keep streamed audio, SSE, and WebSockets as direct pass-through responses. Buffering can make correct work appear stalled.
  • Keep saved settings that affect model imports, cache roots, or endpoint selection aligned with the startup environment restore path and its restart contract.

Important failure modes

TriggerConsequenceGuard
Startup preparation fails or stops progressingClients see a clear not-ready or failed state instead of a partial APIStartup progress, startup gate, watchdog evidence, and crash records
A route or asset mount is registered in the wrong orderA frontend asset can answer where an API route should answerRegister APIs and generated assets before the SPA mount
A remote request lacks the required credential, origin, or CSRF proofHTTP or WebSocket access is rejectedShared middleware plus route-level access dependencies
A share PIN is treated as an admin credentialA consumption client can reach settings, filesystem, or call-control actionsSeparate consumer and admin dependencies
A delegated MCP request relies on its loopback-shaped peerA remote agent could reach admin routes without proving admin capabilityMark delegated requests and check the original credential, including CSRF for cookie mutations
A remote job is assigned after local model preparation startsThe control host wastes memory or runs work on the wrong machineResolve the target before local preparation
A partial or corrupt model cache is treated as readyFirst use fails after setup claimed the model was installedCompleteness checks and repair before readiness
A GPU pool is saturated before a speech request startsThe client waits without useful work or mistakes queue pressure for a bad renderSeparate queue admission and wait budgets, then return a retryable busy result with Retry-After
A started generation exceeds its execution budget or stops sending progressThe request fails as a timeout and the old worker may retain device capacityPer-request budget, liveness heartbeats, worker stack capture, and pool reset
A process-local queue is treated as durableA restart falsely shows active GPU work as resumablePersist final state and mark active work process-local
A client reconnects without event replayThe UI misses progress or final statusPersisted event sequence numbers and replay before live attachment
A streamed response is bufferedAudio or progress appears stalled while work continuesPure ASGI pass-through for audio, SSE, and WebSocket responses
A failure has an empty or unsafe raw messageThe client receives a cryptic reason or a diagnostic that exposes secrets or private pathsShared failure construction, non-empty fallback reasons, and sanitization
Diagnostic consent is absent, revoked, or unreadableTechnical reports are collected or delivered without a valid user grantBounded consent state, grant epochs, fail-closed capture, and independent diagnostic shutdown
A binary body is echoed in validation detailUser audio or other private request data reaches the response or logReport binary size and truncate other echoed input
Native export receives an untrusted pathThe host could reveal or copy files outside the allowed boundaryOne-shot path capability and server-owned source checks
A saved model directory or mirror changes without a restartThe Settings UI reports a new choice while the running process still uses the old cache or import-time endpointPersist the choice in the durable user environment and report restart required
A settings client sends a secret through a read responseCredentials could reach the UI or a remote clientAdmin-gated settings routes, encrypted storage, and masked or boolean-only responses
The backend dies without a clean shutdownThe next client sees only a generic connection failureRun markers, scrubbed crash records, release gating, and acknowledgment
An engine selection ignores host routing or model readinessA saved choice cannot run on the current machine or fails on first useReject hard-unavailable engines and require compatible installed models
A voice bundle is imported without bounded parsing or audio checksThe backend may write unsafe files or create a profile that no engine can useBounded bundles, path confinement, server-named assets, and positive audio decode
A profile file is removed before its database change or active render completesHistory or an in-flight render points to missing audioCommit the record change first and retire referenced files until leases end
A queued batch job is treated as resumable after process exitThe UI shows a false active job or repeats GPU work without a valid ownerKeep the queue process-local and mark orphaned durable jobs failed at startup
A model download is interrupted or cancelled after writing partial cache dataSetup reports an unusable model or leaves disk space occupied by abandoned filesPreflight size checks, bounded retries, completeness validation, and targeted rollback
Audio-only dubbing is exported through the video pathThe client receives a broken mux or no usable outputSelect an audio container and build the export from the generated track and optional background
A designed profile preview finishes after the profile changesOld voice audio becomes the current identity sampleSnapshot design inputs and publish only after an atomic current-row check
A dub cache reuses failed separation or low-quality stemsA new job silently inherits missing or narrow-band background audioStore separation mode and quality markers with the job and rerun incomplete candidates
A user deletes a dub while ingest or rendering is still activeA late save recreates the deleted history row or leaves a misleading task errorAtomic merge/save and purge operations plus time-bounded withdrawal markers

Key files

FileWhy to read it
backend/main.pyPrimary application boundary for startup phases, route composition, mounts, middleware, health, optional services, errors, and shutdown.
backend/…/dependencies.pyDefines local, consumer, admin, desktop, and native access tiers.
backend/…/schemas.pyShows shared system, setup, model, and response contracts.
backend/…/requests.pyShows cross-route request contracts for media, timing, translation, exports, and project saves.
backend/…/generation.pyShows speech request composition, engine and compute choice, streaming, provenance, bounded failures, and take finalization.
backend/…/audiobook.pyShows chapterized long-form speech plans, progress delivery, saved audiobook output, and resume behavior.
backend/…/openai_compat.pyShows the programmatic speech and transcription boundary, aliases, formats, and SDK-shaped failures.
backend/…/capture.pyShows the file transcription boundary and recognition modes.
backend/…/capture_ws.pyShows live dictation framing and partial/final output.
backend/…/events.pyShows the lightweight WebSocket event channel used to invalidate client data.
backend/…/batch.pyShows the process-local batch queue, durable job-facing status, cancellation, retry, and multi-language output flow.
backend/…/archetypes.pyShows the designed-voice catalog, preview choices, caching boundary, and recipe-based profile use.
backend/…/dub_core.pyShows media and audio ingest, source preparation, and localization job state.
backend/…/dub_generate.pyShows segment speech generation, engine conditioning, DSP, and bounded GPU retry behavior.
backend/…/dub_export.pyShows language-aware artifact selection, task replay, audio/video export, and native saves.
backend/…/dub_pipeline.pyShows media preparation, artifact reuse, subprocess progress, separation fallback, and atomic durable dub-job state.
backend/…/calls.pyShows private call control, readiness, event replay, and takeover actions.
backend/…/engines.pyShows engine families, host routing, selection, installation, health checks, and self-tests.
backend/…/model_manager.pyShows shared model lifecycle, capacity sizing, queue admission, synthesis budgets, progress heartbeats, and timeout recovery.
backend/…/profiles.pyShows reusable clone and design profiles, reference lifecycle, consent, previews, and asset ownership.
backend/…/personas.pyShows the portable .ovsvoice persona boundary, inspection, import, export, and consent handling.
backend/…/marketplace.pyShows .omnivoice exchange and the local bundle marketplace.
backend/…/settings.pyShows the admin settings boundary for credentials, compute, performance, storage, mirrors, ASR, LLM providers, skills, and endpoint probes.
backend/…/download.pyShows model install planning, progress, retry, cancellation, rollback, and completeness checks.
backend/…/wizard.pyShows setup readiness, host preflight, accelerator checks, memory and disk checks, and endpoint selection.
backend/…/system.pyShows system readiness information, loaded-model controls, environment persistence, logs, crash evidence, and diagnostics access.
backend/…/cloud_sync.pyShows the desktop boundary for account cloud synchronization.
backend/…/tasks.pyShows live task ownership with durable job state and replayable event history.
backend/…/diagnostic_reports.pyShows explicit-consent technical diagnostics, bounded report fields, local retention, and delivery control.
backend/…/failure.pyBuilds shared failure fields, classifies causes, adds recovery guidance, and sanitizes public diagnostics.
backend/…/error_docs_map.pyMaps stable failure topics to user-facing documentation.