Skip to content

Constants

constants

Defines deterministic constants used by the launcher

Deterministic Data
  • Source Repository URL
  • Docker Image References
  • Docker Compose Identifiers
  • Environment Variables Used By The Server
  • Environment Variables Used By The Modal Host Option

ADVANCED_VARS = (EnvVar('MIRUMOJI_LOGGING_LEVEL', description='The Python Logging Level For The Mirumoji Backend Server'), EnvVar('MIRUMOJI_MODAL_IMAGE', description='Docker Hub Image That Modal Containers Will Run'), EnvVar('MIRUMOJI_MODAL_SCALEDOWN_WINDOW', description='Seconds To Keep An Idle Modal GPU Container Warm Before It Scales Down (Higher Speeds Up Back-To-Back Jobs At A Higher Cost)', default='60'), EnvVar('MIRUMOJI_MAX_LLM_CONCURRENCY', description='How Many LLM Requests Run At Once When Fixing A Batch Of Subtitles', default='4'), EnvVar('MIRUMOJI_SRT_DEFAULT_SYS_MSG', description="The Default LLM System Message Used For SRT Fixing When A Profile Doesn't Have An LLM Template Configured"), EnvVar('MIRUMOJI_BREAKDOWN_DEFAULT_SYS_MSG', description="The Default LLM System Message Used For Word Breakdowns When A Profile Doesn't Have An LLM Template Configured")) module-attribute

Additional environment variables accepted by the mirumoji backend that are not required, but may be used for advanced configuration. All of these have sensible defaults and don't require custom values in most cases

BACKEND_CONTEXT = 'apps/mirumoji' module-attribute

Path determining the location relative to the mirumoji repo's root from which Docker should build the backend Image

BACKEND_CPU_DOCKERFILE = 'apps/mirumoji/src/mirumoji/docker/Dockerfile.local.cpu' module-attribute

Path to the backend Docker Image's Dockerfile relative to the mirumoji repo root when using the modal transcription backend

BACKEND_CPU_IMAGE = 'svdc1/mirumoji:backend-cpu-{version}' module-attribute

String template for a Docker Hub Identifier of the Mirumoji backend image for the modal transcription backend

BACKEND_CPU_LOCAL_IMAGE = 'mirumoji_backend_cpu_local:latest' module-attribute

Local Docker Image Identifier to attach to a locally built Mirumoji backend image for the modal transcription backend

BACKEND_GPU_DOCKERFILE = 'apps/mirumoji/src/mirumoji/docker/Dockerfile.local.gpu' module-attribute

Path to the backend Docker Image's Dockerfile relative to the mirumoji repo root when using the local transcription backend

BACKEND_GPU_IMAGE = 'svdc1/mirumoji:backend-gpu-{version}' module-attribute

String template for Docker Hub Identifier of the Mirumoji backend image for the local transcription backend

BACKEND_GPU_LOCAL_IMAGE = 'mirumoji_backend_gpu_local:latest' module-attribute

Local Docker Image Identifier to attach to a locally built Mirumoji backend image for the local transcription backend

BACKEND_SERVICE = 'backend' module-attribute

Identifier for the backend service in the Mirumoji Docker Compose application

CONFIG_ENV_VARS = (*LLM_VARS, *MODAL_VARS, *ADVANCED_VARS, *MODAL_HOST_VARS) module-attribute

Every user-facing environment variable that the launcher manages in the config file (LLM Providers + Modal + Advanced Overrides + Hosted Deploy)

CONFIG_ENV_VAR_NAMES = tuple((v.name) for v in CONFIG_ENV_VARS) module-attribute

The names of every managed CONFIG_ENV_VARS entry

The single source for the managed-config name list, shared by the CLI and the GUI so they overlay and inject exactly the same keys

CONFIG_KEYS = frozenset([(v.name) for v in CONFIG_ENV_VARS] + list(DEPLOY_OPTION_VARS)) module-attribute

Every environment variable key that the launcher accepts in the managed config file. Used to reject unknown keys in mirumoji config set/delete

DEFAULT_BRANCH = 'main' module-attribute

Which branch of the Mirumoji GitHub repo to use to build images

DEFAULT_HOST_GPU = 'A10G' module-attribute

The GPU a GPU host falls back to when MODAL_GPU_VAR is unset, matching the MIRUMOJI_MODAL_GPU config default

DEPLOY_OPTION_VARS = (TRANSCRIBE_BACKEND_VAR, IMAGE_SOURCE_VAR, IMAGE_VERSION_VAR) module-attribute

The launcher-only deploy options, chosen at deploy time and never injected into a running container

Deploy Options
  • MIRUMOJI_TRANSCRIBE_BACKEND picks the transcription backend (enum)

  • MIRUMOJI_IMAGE_SOURCE picks pull-vs-build (enum)

  • MIRUMOJI_IMAGE_VERSION pins the published image version (free-form, validated against Docker Hub)

Unlike CONFIG_ENV_VARS, these steer what and how the launcher deploys rather than configuring the running server

FRONTEND_CONTEXT = 'apps/frontend' module-attribute

Path determining the location relative to the mirumoji repo's root from which Docker should build the frontend Image

FRONTEND_DOCKERFILE = 'apps/frontend/Dockerfile' module-attribute

Path to the fontend Docker Image's Dockerfile relative to the mirumoji repo root

FRONTEND_IMAGE = 'svdc1/mirumoji:frontend-{version}' module-attribute

String template for a Docker Hub Identifier of the Mirumoji frontend image

FRONTEND_LOCAL_IMAGE = 'mirumoji_frontend_local:latest' module-attribute

Local Docker Image Identifier to attach to a locally built Mirumoji frontend image

FRONTEND_SERVICE = 'frontend' module-attribute

Identifier for the frotend service in the Mirumoji Docker Compose application

HOST_LAN_IP_VAR = 'HOST_LAN_IP' module-attribute

Stores the end-user's IPv4 LAN IP, discovered automatically with the socket library

HOST_NONPREEMPTIBLE_VAR = 'MIRUMOJI_HOST_NONPREEMPTIBLE' module-attribute

Managed config key running the CPU host on non-preemptible capacity

What It Does

When 1, Modal guarantees the always-warm CPU container is never reclaimed mid-job, at a 3x CPU and memory price multiplier, so a spot reclaim never restarts the server and drops its in-process job

Not For GPU Hosts

Modal does not support non-preemptible GPU functions, so this cannot be combined with HOST_ON_GPU_VAR

HOST_ON_GPU_VAR = 'MIRUMOJI_HOST_ON_GPU' module-attribute

Managed config key toggling the single-app GPU host

The Two Host Modes
  • Default (0 / unset) → the always-warm web container is CPU-Only and offloads transcription and conversion to the separate on-demand mirumoji-offload GPU app, so a GPU is paid for only while a job runs

  • Enabled (1) → the web container itself runs on a GPU (the type comes from MODAL_GPU_VAR) with the local whisper backend in-process, so there is one app and no offload worker, at the cost of an always-warm GPU

Why A Toggle Rather Than A Second GPU Variable

The GPU type is already configured once by MODAL_GPU_VAR (MIRUMOJI_MODAL_GPU), so this stays a simple on/off switch and never competes with it

IMAGE_SOURCE_VAR = 'MIRUMOJI_IMAGE_SOURCE' module-attribute

Persists the launcher's image-source choice (pull pre-built vs build locally) in the managed config file so that it's remembered across runs

Launcher-Only. The compose template never references it, and the server ignores it

IMAGE_VERSION_VAR = 'MIRUMOJI_IMAGE_VERSION' module-attribute

Pins the published image version the launcher pulls (and composes the Modal host from), defaulting to the installed package version

Launcher-Only. It fills the {version} in the image references above and is never passed to the server or a container. A deploy option (see DEPLOY_OPTION_VARS)

LLM_VARS = (EnvVar('OPENAI_API_KEY', secret=True, description='Make GPT Available For LLM Features'), EnvVar('ANTHROPIC_API_KEY', secret=True, description='Make Claude Available For LLM Features'), EnvVar('GEMINI_API_KEY', secret=True, description='Make Gemini Available For LLM Features'), EnvVar('MIRUMOJI_LLM_API_KEY', secret=True, description='Use A Custom OpenAI-Compatible Endpoint For LLM Features (Leave Empty If Not Applicable)'), EnvVar('MIRUMOJI_LLM_BASE_URL', description='Use A Custom OpenAI-Compatible Endpoint For LLM Features')) module-attribute

Optional LLM Provider Keys

The frontend gates the use of LLM capabilities when none of these are configured

MODAL_GPU_IMAGE = 'svdc1/mirumoji-modal-gpu:{version}' module-attribute

String template for the Docker Hub Identifier of the published Modal GPU image

Unlike BACKEND_GPU_IMAGE, this image bakes the pre-cached faster-whisper model. A GPU host grafts only that model cache from it onto the leaner BACKEND_GPU_IMAGE, so the first in-process transcription needs no download (see launcher.modal.host)

MODAL_GPU_VAR = 'MIRUMOJI_MODAL_GPU' module-attribute

Managed config key naming the Modal GPU type (e.g. A10G, A100)

Passed through exactly as set, independent of any host-mode toggle. The on-demand offload worker reads it, and so does a GPU host (HOST_ON_GPU_VAR) for its own container, each falling back to DEFAULT_HOST_GPU only where the value is read while unset

MODAL_HOST_VARS = (EnvVar('MIRUMOJI_WEB_PASSWORD', secret=True, description='Login Password For The Modal-Hosted App (Generated On First Deploy When Unset)'), EnvVar('MIRUMOJI_HOST_MAX_CONCURRENT_REQUESTS', default='100', description='How Many Requests The Modal-Hosted App Container Serves At Once'), EnvVar('MIRUMOJI_HOST_CPU', default='2', description='CPU Cores Reserved For The Always-Warm Modal-Hosted Web Container (Higher Is Faster But Costs More)'), EnvVar('MIRUMOJI_HOST_MEMORY', default='4096', description='Memory In MiB Reserved For The Always-Warm Modal-Hosted Web Container (Higher Avoids Restarts But Costs More)'), EnvVar('MIRUMOJI_HOST_ON_GPU', default='0', description='Run The Modal-Hosted App On A GPU With Whisper In-Process (1) Instead Of A CPU Host That Offloads To An On-Demand GPU Worker (0). Uses MIRUMOJI_MODAL_GPU For The GPU Type'), EnvVar('MIRUMOJI_HOST_NONPREEMPTIBLE', default='0', description='Run The CPU Host On Non-Preemptible Capacity So It Is Never Reclaimed Mid-Job (1), At A 3x CPU + Memory Cost. Not Available With MIRUMOJI_HOST_ON_GPU')) module-attribute

Environment variables specific to the Modal-hosted deploy

The login username is always mirumoji, only the password is configurable

GPU Tasks In Modal-Hosted App
  • The app deployed by mirumoji modal deploy uses the same offload worker (a second, GPU-enabled modal app) that the server's modal transcription backend uses

  • This means that all of the Modal-related environment variables in MODAL_VARS and ADVANCED_VARS also apply to the modal-hosted deploy app

MODAL_VARS = (EnvVar('MODAL_TOKEN_ID', required=True, secret=True, description='Modal Token ID (Required For The Modal Backend)'), EnvVar('MODAL_TOKEN_SECRET', required=True, secret=True, description='Modal Token Secret (Required For The Modal Backend)'), EnvVar('MIRUMOJI_MODAL_GPU', description='Which GPU To Use In The Modal Containers', default='A10G'), EnvVar('MODAL_FORCE_BUILD', description='Forces Modal Containers To Update The Cached Mirumoji App Image', default='0')) module-attribute

Modal Credentials + Configuration Environment Variables (Required Only For The Modal Transcription Backend)

PROJECT_NAME = 'mirumoji' module-attribute

Name of the Docker Compose project

REPO_URL = 'https://github.com/svdC1/mirumoji.git' module-attribute

The Mirumoji GitHub repository URL

TRANSCRIBE_BACKEND_VAR = 'MIRUMOJI_TRANSCRIBE_BACKEND' module-attribute

Stores a Backend value to be passed to the mirumoji server on application startup

backend_vars(backend)

Returns all relevant environment variables for a given transcription backend

MODAL Backend
  • All Modal-Related Variables
  • All LLM Provider API Keys
  • All Advanced Variables
LOCAL Backend
  • All LLM Provider API Keys
  • All Advanced Variables

Parameters:

Name Type Description Default
backend Backend

The chosen transcription backend

required

Returns:

Type Description
EnvVar

The ordered env vars that may be passed when the transcription backend

...

choice is backend

deployment_choices(key)

Returns the allowed values for a deployment key, or None for free-form keys

Parameters:

Name Type Description Default
key str

The environment variable key

required

Returns:

Type Description
tuple[str, ...] | None

The permitted enum values for MIRUMOJI_TRANSCRIBE_BACKEND /

tuple[str, ...] | None

MIRUMOJI_IMAGE_SOURCE, else None

is_config_key(key)

Reports whether key is a recognised managed-config key

Parameters:

Name Type Description Default
key str

The candidate environment-variable name

required

Returns:

Type Description
bool

True when the key is managed by the launcher