Translates a WebVTT subtitle track into the viewer's language through an upstream LLM. The source track is fetched once, split into cue batches, and translated progressively: a client polling the same URL sees a growing prefix of translated cues before the job finishes. In-flight progress and the finished result are cached (Redis, or S3 when configured), keyed by info hash + subtitle path + target language + model + prompt version, so repeat requests for the same track and language are served from cache instead of re-translated.
The service is reached as a Matryoshka mod on the subtitle URL:
/<...>~tr:<lang>/<name>.vtt
<lang> is a 2-letter code (see below). THP strips the mod segment from the path it forwards and sends its argument as X-Mod-Extra (~tr:pt → pt), which is what the handler reads; parsing the language back out of the request path is the fallback for a direct call, which keeps the full path.
Request headers (set by the proxy chain):
| Header | Meaning |
|---|---|
X-Source-Url |
URL of the original (untranslated) VTT track. Required. |
X-Info-Hash |
Torrent info hash, part of the cache key. |
X-Path |
Path of the subtitle file within the torrent, part of the cache key after /session/<id>/ is removed. |
Optional query parameters:
?srclang=<code>— source language hint passed to the model. It must be one of the codes below; anything else is dropped (the hint is optional, so a bad one costs the viewer nothing).?names=a,b,c— glossary of proper names/terms to keep untranslated or transliterate consistently; comma-separated, capped at 30 entries of 40 runes each. Each entry is flattened to a single line — control characters and newlines become spaces, runs of whitespace collapse — and entries that come out empty are dropped.
Neither parameter is part of the cache key, and that is deliberate: the artifact is shared by everyone watching the track, so the first requester's hint and glossary are baked into it. Key stability across viewers is the point — a per-request key would translate the same film once per visitor. It is also why both are validated rather than passed through: what the first requester writes into the prompt is what every later viewer of that file and language reads back, for 24 h from Redis and indefinitely from S3.
Response headers:
X-Subtitle-Progress: done/total— cues translated so far out of the total cue count.HEADreports progress without triggering or waiting on a translation.0/0means unknown: no job has registered for this key yet (nothing started it, or it is still fetching the source). Keep polling — it is not "nothing to translate".- The artifact is complete only when
done == totalandtotal > 0, or when the response carries the finalCache-Control: public, max-age=86400.
Cache-Control: public, max-age=86400on the finished artifact,Cache-Control: no-storeon a partial (in-progress) response.X-Subtitle-Live: 1— set only whenX-Source-Urlis a live HLS subtitle playlist and the job is not finished yet. See Live HLS source.X-Subtitle-Status: done|stopped— set only whenX-Source-Urlis a live HLS subtitle playlist and the run has reached a terminal state:done— the playlist reached#EXT-X-ENDLISTand every pending cue was translated, whether or not that produced a final artifact (a run that joined after a seek reaches this state too — see Live HLS source — and still may not write one).stopped— the run was cut short: the transcoder session went away, or the source outgrew--max-source-bytes/--max-cues, before it finished.- Absent for every other live response (still running, or paused because
nobody polled the key for a while — see
--live-idle) and for every offline/file-source response, live or not: a finished offline artifact signals throughCache-Control: public, max-age=86400instead, the same as before this header existed. - A later transcoder session on the same key is new work and starts
without this header, even if the previous session ended
done.
X-Subtitle-Pending-From: <seconds>— set only whenX-Source-Urlis a live HLS subtitle playlist and a cue the viewer can still meet is untranslated: decimal movie-time seconds (3 decimals, e.g.612.480) of theStartof the earliest such cue. See Live HLS source for exactly which cues count.- Absent when there is no such cue: everything at or ahead of the current
position is translated, the response is a finished/final artifact, or
X-Source-Urlis not a live playlist at all. - An unread run is pending from the viewer's position. Right after a
seek the document has no cue for the new position yet: the transcoder
writes the subtitle playlist when the first subtitle segment closes,
which takes the next cue and, on a source that is still downloading,
minutes. While the playlist has not ended, the run is younger than two
minutes (
liveUnreadHold), no segment of it has been read and the document holds no cue at or after the position, the header carries the position itself — "what you are about to hear has not been read", not "nothing pending". The first segment of the run ends the special case; the two-minute bound is for stretches with no dialogue left (end credits), where no subtitle playlist is ever written. Needs a transcoder whose playlist stub carries#EXT-X-SESSION-OFFSET(content-transcodercdbc680); without it the new run is not recognised as one.
- Absent when there is no such cue: everything at or ahead of the current
position is translated, the response is a finished/final artifact, or
X-Subtitle-Session-Offset: <seconds>— on live responses once the playlist has been read: the#EXT-X-SESSION-OFFSETthe answer (andX-Subtitle-Pending-From) was computed against. A player that has just seeked compares it with its own session offset to tell an answer about its run from one read before the transcoder listed that run.
Request parameters:
pos=<seconds>— the viewer's playhead, in movie time. For a file source this is what makes the job position-aware the way a live one is: the position is kept per key (best effort, shared across replicas), batches are ordered by the same rule the live loop uses — pending cues from--lead-in(30 s) behind the position onward first, then the backlog — and it is re-read at every batch boundary, so a seek redirects the job within one batch. A poll carryingposis also answered withX-Subtitle-Pending-Fromcomputed against it, by the same function the live path uses. Partial file bodies render like live ones: every translated cue wherever it sits, pending cues left out (a position-ordered job fills the middle of the file first, and a prefix would hide exactly the cues the viewer is watching);donecounts translated cues rather than a prefix, so structurally-empty cues (nothing left after normalization) count as done wherever they sit instead of only inside the translated prefix — the one visible difference a poll withoutpossees. A job nobody positions translates in file order, as before. Ignored on live sources (their position comes from the playlist itself). The position is one per artifact key: two viewers of the same track overwrite each other and the job alternates between their neighbourhoods at batch granularity — every batch still shrinks the pending set, and each viewer's frontier answer is computed against their own poll'spos.
Request parameters (live sources):
sof=<seconds>— the session offset the player is watching. When it differs from the run the source last read by a second or more, the playlist is re-read now (at most once per 500 ms per key per replica) instead of after--live-poll-interval. Measured on a real session: the transcoder lists a new run ~200 ms after the seek POST and the player's first poll after a seek lands ~100 ms after it, so without this the answer after a seek described the old run for seconds. Not negative, finite, or it is ignored. The same 500 ms gate applies for the first 30 s of a run whatever the poll says: the player decides whether to hold playback for a seek's subtitles from those first answers, and a replica that does not own the job would otherwise serve a document seconds old. A failed read in a fresh run is retried by the job after 1 s instead of a poll interval.
Status codes:
| Code | Meaning |
|---|---|
| 400 | Missing/unsupported target language in the path, missing X-Source-Url, or a source URL whose scheme is not http/https. |
| 404 | Source track could not be fetched or parsed. |
| 413 | Source track exceeds --max-source-bytes or --max-cues. |
| 501 | No upstream API key configured — translation is disabled. |
| 502 | Upstream/store state unavailable while assembling the response. |
Error bodies are fixed strings (bad request, source unavailable, source too large, too many cues, upstream state unavailable). The cause — source URL, dial error, parse error — is logged, never returned.
A GET starts (or resumes) the background job for the key if one isn't already running, and returns the current snapshot immediately (cached final artifact, or the cues translated so far). Callers poll the same URL until X-Subtitle-Progress reports done. The parsed source is cached in-process for 10 minutes per key, so polling costs one source fetch, not one per poll. Both in-process caches — parsed sources and live sources — hold 16 entries per replica: a parsed 1 MiB track is ~11 MB resident, which is the number that has to fit under the pod's memory limit.
At most --max-jobs translations run at once per replica (--live-max-jobs for live ones, counted separately); further keys are registered immediately and start as slots free up.
When X-Source-Url points at a media playlist (….m3u8) — the transcoder's
subtitle variant <file>~hls/session/<id>/s<N>.m3u8 — the job follows the
playlist instead of reading one file: every --live-poll-interval it re-reads
the playlist, fetches the segments it has not seen, shifts their cues by
#EXT-X-SESSION-OFFSET into movie time and translates what has accumulated —
a batch of --batch-size cues, or fewer once the oldest pending cue has waited
--live-batch-wait.
- A live source is identified by its URL without the query: scheme, host
and path. The transcoder session id lives in the path
(
…~hls/session/<id>/s<N>.m3u8), while the query carries things that change within one session — the player re-requests the track as?…&rev=<n>every ~15 s while cues arrive, and the session token can be renewed. A poll whose identity matches the source being followed only updates the URL that source fetches from (the newest query is the one upstream will still accept); nothing is retired, no document is rebuilt and no segment is fetched twice. A different session id is a different session, and swaps the source as before. - One key follows one source at a time, and the key deliberately outlives
a session (
X-Pathis keyed with/session/<id>/removed). A second viewer watching the same file and language at a different position therefore shares that one source and may, for a while, be served a document that does not cover where they are — the cues they need arrive once the runs converge on the same range, and a translation already paid for is matched by cue identity rather than bought again. It self-heals; it is not an error state. X-Subtitle-Live: 1is set while the playlist is live (no#EXT-X-ENDLIST) or the job is still writing. Do not readdone == totalas complete while it is present. The body carries the translated cues only: a cue not translated yet is omitted rather than shown in the source language. A cue the model refused or answered with the wrong line count is the exception — it keeps its source text and counts as done, exactly as on the file path.- The final artifact is written only for a contiguous run — offset 0 from the
first read to
#EXT-X-ENDLIST. A viewer who seeks gets a partial translation for the session (kept in Redis for 24 h under the same key, reused by cue identity on the next session); the next contiguous viewing completes it. - After a seek, cues at or after the current position are translated before the backlog behind it.
- For the first 30 s of a run (the first read of the playlist, or a seek
moving
#EXT-X-SESSION-OFFSET) a partial batch holding a cue the viewer can still meet is translated at once instead of waiting--live-batch-waitfor company: that is when the viewer is standing on untranslated cues. A new run seen by a viewer's poll also wakes the job immediately rather than on its next--live-poll-intervaltick (no sooner than 1 s after its previous read, so a flapping offset cannot make it read back to back). The run is taken from the playlist header before any segment is fetched, so a failing newest segment does not hide it. Without these, the first line at a new position waited for a tick, then for the batch window, then for the upstream call. - A reply line that comes back empty for a cue with text keeps the original
text, like every other unusable reply: stored as empty it stayed pending
forever, re-sent with every batch and pinning
X-Subtitle-Pending-From. - A live job works from the viewer's position when a poll carries one
(
pos), and from the start of the run (#EXT-X-SESSION-OFFSET) when none does. The start of the run is where the viewer is right after a seek and nowhere near them later: someone who turns the translation on eleven minutes into a run would otherwise wait for eleven minutes of backlog to be translated first. The position is stored under the run it was reported in (<key>@<run offset, ms>), and only from a poll that is about the current run (sofabsent or matching,posnot before the run start) — so a position left over from before a seek is never read, with no clean-up to get wrong. Both the batch order andX-Subtitle-Pending-Fromuse it. - Lead-in (
--lead-in, 30 s; both kinds of job). Batches start from cues whoseEndis at or afterposition − lead-in, not fromStart >= position: the cue on screen right now began before the viewer got there, and with the old rule it and the exchange before it were "behind" and translated last. A batch is ~50 cues; half a minute is a handful of them, in the same upstream call. The frontier stays on the true position. X-Subtitle-Pending-Fromtells a poller whether the next cue the viewer will actually reach is translated yet — something the done/total counts cannot answer, since in live mode there is almost always an untranslated backlog behind the transcoder's newest segment, and after a seek the untranslated cues may lie behind the playhead (irrelevant) or ahead of it (what matters). It is theStartof the earliest untranslated cue among those whoseEndis at or after the viewer's position (the current#EXT-X-SESSION-OFFSETwhen no poll reported one), i.e. cues already fully behind the playhead are excluded — a job that went ahead-first (see above) leaves them pending for a long time, and reporting them would keep a "translation is behind" banner up for a passage the viewer already left, while a cue straddling the playhead (still on screen) is included.- The job stops on its own when nobody polled the key for
--live-idle: reading the playlist keeps the transcoder session alive, so an unwatched translation would otherwise transcode the whole file for nobody. It also stops when the session is gone (404/503 from the transcoder) or the source outgrew its caps, keeping progress. The idle stop leaves the record live (it is a pause, not an end — the next poll resumes it); the other two setX-Subtitle-Status: stoppedon it (see Response headers). - A segment that fails three times in a row is given up on — marked seen,
counted by
subtitle_translate_live_segments_skipped_total, and left as a hole that stops the run from writing a final artifact — because one segment the transcoder has GC'd while still listing it (or one behind a path the proxy keeps rate-limiting) is retried at the head of the playlist and would otherwise freeze the whole document while the playlist keeps answering 200. - A poll refreshes the source it is served from only if the last attempt is
older than
--live-poll-interval— successful or not, so an upstream that is failing costs one playlist read per interval per replica rather than one per poll — and never waits for a refresh already in flight, serving what is known instead of queueing behind a stalled read. - Size caps apply to the accumulated document:
--max-source-bytesto the sum of segment bytes,--max-cuesto the cue count. - Cue identity is the cue's text plus a 3-second time window across runs,
not an exact timestamp (within one run it stays exact, so a line genuinely
said twice inside the window is two cues): the transcoder reports the requested (30 s-quantized) seek as
#EXT-X-SESSION-OFFSETbut starts each run at the keyframe at or before it, so every run's timeline is offset by up to one GOP (measured: 1.657 s between two runs of the same file). A translated cue therefore carries the timing of the run that first produced it, and after a seek it can sit up to a GOP away from the player's own timeline — the same as every side-loaded track on this platform today. Without the window the replayed range is translated and rendered twice. - A run that ends without producing a final artifact (it joined after a seek,
so the document has holes) is finished for good for that run: the record
is written with the live flag cleared and
X-Subtitle-Status: done(it did reach#EXT-X-ENDLISTwith nothing left pending — a final artifact is a separate question from whether the run is done), and no later poll starts another job against that source. A seek that brings the same session new cues re-arms it — the run is not over, it moved — which is also what clearsX-Subtitle-Statusback off until this run reaches its own end. A genuinely new transcoder session is new work regardless. - Live jobs are bounded by
--live-max-jobs, separately from--max-jobs: a live job holds its slot for the length of a film while doing almost nothing, so queueing it behind offline work (or offline work behind it) is the wrong trade.
Cue timings and cue count are never changed: a cue that normalizes to nothing stays as an empty cue at its own timestamp. Cue settings (align, line, position, size, region), the cue's style and region references, and the document-level STYLE and REGION blocks are copied from the source onto the translation.
Inline markup inside cue text is flattened: voice spans (<v Speaker>), <b>/<i>/<u>, class and timestamp tags come back as plain text. The model is sent text and returns text, so the tags do not survive. Hearing-impaired markup ([DOOR SLAMS], (sighs)) and music-only lines are stripped before translation.
en English ru Russian es Spanish de German fr French
pt Portuguese it Italian pl Polish tr Turkish nl Dutch
cs Czech uk Ukrainian zh Chinese ja Japanese ko Korean
ar Arabic hi Hindi id Indonesian vi Vietnamese th Thai
sv Swedish no Norwegian da Danish fi Finnish el Greek
he Hebrew hu Hungarian ro Romanian bg Bulgarian sr Serbian
hr Croatian sk Slovak sl Slovenian lt Lithuanian lv Latvian
et Estonian fa Persian ms Malay bn Bengali ta Tamil
kk Kazakh ka Georgian hy Armenian az Azerbaijani ca Catalan
This is broader than the UI's locale set — the target language comes from the viewer's subtitle preference, not the site's i18n bundle.
Credentials choose the provider, matching web-ui recommendations/enrichment:
| Credentials | Provider | Default model |
|---|---|---|
ANTHROPIC_API_KEY only |
Anthropic | claude-haiku-4-5-20251001 |
OPENAI_API_KEY only |
OpenAI | gpt-4.1-mini |
| Both | Anthropic (preserves existing deployments) | claude-haiku-4-5-20251001 |
| Neither, or whitespace-only keys | Translation disabled; HTTP 501 | — |
Selection depends on configuration, never reachability. API failures do not
switch providers. SUBTITLE_TRANSLATE_MODEL overrides the provider default;
when changing providers, clear an old explicit model or set a model supported
by the new provider. OPENAI_BASE_URL can override the OpenAI endpoint.
OpenAI uses the Responses API
with store=false. Requests carry the same system prompt, dialogue context,
glossary and numbered cues as Anthropic. OpenAI sampling uses model defaults
(no explicit temperature); Anthropic retains temperature 0. Translation is
still published progressively per batch for both file and live HLS sources.
Both providers retry malformed or out-of-order numbered replies once, count
usage from both attempts, classify token-limit truncation as ErrTruncated
(for the runner's existing batch splitting), and classify refusals/content
filtering as ErrRefused. Other incomplete/failed replies and transport errors
are not treated as valid translations. Cancellation and per-batch timeouts
propagate to the upstream request. No timestamps or cue ids are generated by
the model: the runner attaches each translated line to the original cue.
Artifact keys already include the model id, so changing from Claude to GPT creates a separate cached translation without rewriting old artifacts. The existing Anthropic cost estimate below does not describe OpenAI; OpenAI cost and language-pair quality should be measured with representative subtitles.
Example OpenAI configuration:
ANTHROPIC_API_KEY=
OPENAI_API_KEY=your-key
SUBTITLE_TRANSLATE_MODEL=gpt-4.1-miniThe private Helm chart keeps the existing Anthropic setting translate.apiKey
and adds openai.apiKey / openai.baseURL. An empty translate.model uses the
provider default. Both credentials are stored in the Kubernetes Secret; its
checksum is included in the pod template so a key/provider change restarts
pods even when the image and model override are unchanged.
NAME:
subtitle-translate - translates WebVTT subtitles into the viewer's language
USAGE:
subtitle-translate [global options] command [command options] [arguments...]
VERSION:
0.1.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--probe-host value probe listening host [$PROBE_HOST]
--probe-port value probe listening port (default: 8081) [$PROBE_PORT]
--use-probe enable probe [$USE_PROBE]
--prom-host value prometheus metrics listening host [$PROM_HOST]
--prom-port value prometheus metrics listening port (default: 8083) [$PROM_PORT]
--use-prom use prometheus metrics [$USE_PROM]
--host value listening host [$WEB_HOST]
--port value http listening port (default: 8080) [$WEB_PORT]
--anthropic-api-key value Anthropic API key; takes precedence over OpenAI [$ANTHROPIC_API_KEY]
--openai-api-key value OpenAI API key; used when the Anthropic key is empty [$OPENAI_API_KEY]
--openai-base-url value OpenAI API base URL (default: "https://api.openai.com/v1") [$OPENAI_BASE_URL]
--model value upstream model id; empty uses the configured provider default [$SUBTITLE_TRANSLATE_MODEL]
--upstream-timeout value per-batch upstream timeout, seconds (default: 60) [$SUBTITLE_TRANSLATE_UPSTREAM_TIMEOUT]
--max-tokens value max output tokens per batch (default: 8192) [$SUBTITLE_TRANSLATE_MAX_TOKENS]
--redis-host value redis host (default: "localhost") [$REDIS_MASTER_SERVICE_HOST, $ REDIS_SERVICE_HOST]
--redis-port value redis port (default: 6379) [$REDIS_MASTER_SERVICE_PORT, $ REDIS_SERVICE_PORT]
--redis-pass value redis pass [$REDIS_PASS]
--redis-user value redis user (default: "default") [$REDIS_USER]
--redis-sentinel-port value redis sentinel port (default: 0) [$REDIS_SERVICE_PORT_REDIS_SENTINEL]
--redis-sentinel-master-name value redis sentinel master name (default: "mymaster") [$REDIS_SERVICE_SENTINEL_MASTER_NAME]
--aws-access-key-id value AWS Access Key ID [$AWS_ACCESS_KEY_ID]
--aws-secret-access-key value AWS Secret Access Key [$AWS_SECRET_ACCESS_KEY]
--aws-endpoint value AWS Endpoint [$AWS_ENDPOINT]
--aws-region value AWS Region [$AWS_REGION]
--aws-no-ssl [$AWS_NO_SSL]
--use-s3 store finished translations in S3 [$USE_S3]
--aws-bucket value S3 bucket (one bucket per service) (default: "subtitle-translate") [$AWS_BUCKET]
--s3-prefix value optional S3 key prefix [$S3_PREFIX]
--batch-size value cues per upstream request (default: 50) [$SUBTITLE_TRANSLATE_BATCH_SIZE]
--max-cues value largest source track accepted, in cues (default: 5000) [$SUBTITLE_TRANSLATE_MAX_CUES]
--max-source-bytes value largest source track accepted, in bytes (default: 1048576) [$SUBTITLE_TRANSLATE_MAX_SOURCE_BYTES]
--lock-ttl value how long one replica owns a translation key, seconds; also the per-batch deadline (default: 300) [$SUBTITLE_TRANSLATE_LOCK_TTL]
--max-jobs value translation jobs running at once in this replica (default: 4) [$SUBTITLE_TRANSLATE_MAX_JOBS]
--live-poll-interval value how often a live HLS subtitle playlist is re-read, seconds (default: 4) [$SUBTITLE_TRANSLATE_LIVE_POLL_INTERVAL]
--live-batch-wait value longest a pending live cue waits before a batch smaller than --batch-size is sent, seconds (default: 10) [$SUBTITLE_TRANSLATE_LIVE_BATCH_WAIT]
--lead-in value a job starts its batches this far behind the viewer's position, seconds; 0 turns it off (default: 30) [$SUBTITLE_TRANSLATE_LEAD_IN]
--live-idle value a live job stops when nobody polled its key for this long, seconds (default: 90) [$SUBTITLE_TRANSLATE_LIVE_IDLE]
--live-max-jobs value live translation jobs running at once in this replica, bounded separately from --max-jobs (default: 16) [$SUBTITLE_TRANSLATE_LIVE_MAX_JOBS]
--help, -h show help
--version, -v print the version
Served when --use-prom is set.
| Name | Type | Meaning |
|---|---|---|
subtitle_translate_batches_total |
counter | Cue batches successfully translated (a batch that fell back to source text is not counted here). |
subtitle_translate_tokens_input_total |
counter | Upstream input tokens consumed. |
subtitle_translate_tokens_output_total |
counter | Upstream output tokens consumed. |
subtitle_translate_batches_fallback_total{reason} |
counter | Batches (or split halves) whose cues kept their source text, by reason: mismatch, truncated, refusal. |
subtitle_translate_job_errors_total{code} |
counter | Job errors by cause (panic, store, upstream, render, truncated, refusal, lock_lost, too_large, source_gone, viewer_gone). source_gone and viewer_gone are live-job terminations, not failures: the transcoder session ended or nobody polled the key for --live-idle — expected outcomes of a live translation, not something to page on. |
subtitle_translate_jobs_running |
gauge | Translation jobs holding a concurrency slot (--max-jobs bounds the offline ones, --live-max-jobs the live ones). |
subtitle_translate_job_seconds |
histogram | End-to-end duration of a finished translation job. |
subtitle_translate_live_segments_skipped_total |
counter | Live segments given up on after three consecutive failures. Each one is a hole in the document (and blocks the final artifact for that run), so a steady rate on one film means the transcoder or the proxy in front of it is losing segments. |
subtitle_translate_line_mismatch_total |
counter | Upstream replies whose line count didn't match the batch (retried once, then the original text is kept). |
subtitle_translate_batch_seconds{source} |
histogram | One batch, upstream call plus store write, by source (live, file). What a viewer waits on after a seek, once or twice over. |
subtitle_translate_live_refresh_seconds |
histogram | One read of a live playlist, its new segments included. Segments are fetched one after another. |
subtitle_translate_live_refresh_segments |
histogram | Segments fetched by one such read. |
Two rules keep a viewer's wait after a seek to one short upstream call (2026-09-19; before them a seek measured 32 s in production, 9 s of it behind a batch ordered for the position the viewer had left and 21.6 s on a batch that carried 3 cues from the new position and 47 from the backlog):
- What the viewer can still meet is sent alone. A batch is cues ending at or after
position − --lead-in, up to--batch-size; the cues they have already passed are translated only when nothing ahead is pending — which, with the transcoder 20–25× ahead of the viewer, is most of the time. It used to be topped up with the backlog. - A batch ordered for the old run is dropped when a read of the playlist sees a new run while
the call is out — a viewer's poll naming the new run (
sof) is what triggers that read — unless the batch happens to serve the new run too (batchServes: a cue ending at or afteroffset − --lead-inand beginning within five minutes of it). What it had translated stays; the job goes on with the new run. Thelive batchline carriesdropped=true. Cost: the tokens of one interrupted call per seek.
Two info lines make a viewer's wait after a seek readable after the fact (added 2026-09-19, when a
110 s hold in production could not be told apart from "translated from the start of the film"):
live batch— one per batch:run(the#EXT-X-SESSION-OFFSETthe job believes it is on),fromandfromSource(where it thinks the viewer is, and who said so:poll= a position a viewer reported in this run,run= the start of the run standing in for one),firstCue/lastCue(the stretch of film the batch covers, movie seconds),cues,pending,seconds(the call),runAge,ok.live read— for the first read of a run (newRun), and for any read slower than 2 s or larger than 25 segments:run,segments,cuesAdded,seconds,ended. Ordinary reads stay in the histograms.
Output tokens dominate: the model writes roughly as much as it reads, and the source is sent once per batch with a few lines of context. For a 2-hour film (~1500 cues), the existing Anthropic Haiku 4.5 estimate is $0.3–0.5 to translate into one language. The result is cached per track and language, so the cost is paid once, not per viewer — and --max-cues bounds the worst single request.
go vet ./...
go test -race ./...
python3 scripts/negative_controls.pyThe negative controls remove one behavior at a time through temporary Go overlays. Each selected regression test must pass on the original code and fail on its mutant. Compilation errors do not count. CI gates the image build on these checks. No tracked source is changed by the controls.
ANTHROPIC_API_KEY=… REDIS_SERVICE_HOST=localhost go run . --use-probe=false --use-prom=false
curl -H 'X-Source-Url: http://localhost:8000/sample.vtt' -H 'X-Info-Hash: t' -H 'X-Path: /sample.vtt' \
-D - 'http://localhost:8080/t/sample.vtt~tr:pt/sample.vtt'The service enforces no authorization of its own — access is gated upstream by web-ui/torrent-http-proxy.
MIT — see LICENSE.