1
CLI
Hirad edited this page 2026-07-23 10:23:39 +03:30
Command-Line Interface
Translate command
srtx translate INPUT_PATH --to LANGUAGE
Example:
srtx translate movie.srt --to Persian --batch-size 100
The equivalent module invocation is:
python -m srtx translate movie.srt --to Persian --batch-size 100
Arguments and options
| Argument or option | Short form | Required | Description |
|---|---|---|---|
INPUT_PATH |
Yes | Local readable SRT file | |
--to |
Yes | Target language | |
--output |
-o |
No | Explicit output SRT path |
--model |
-m |
No | Gemini model identifier |
--api-key |
-k |
No | Regular Gemini API key |
--batch-size |
-b |
No | Positive subtitles-per-request limit |
API-key configuration
The recommended method is:
export SRTX_API_KEY="your-gemini-api-key"
The CLI also accepts GEMINI_API_KEY.
An explicit CLI key is supported:
srtx translate movie.srt \
--to Persian \
--api-key "your-gemini-api-key"
Environment variables are safer because command-line arguments may be retained in shell history or visible to other processes.
Output behavior
Without --output:
movie.srt
movie_translated.srt
With an explicit output:
srtx translate movie.srt \
--to Persian \
--output movie.fa.srt
The output directory must already exist.
Progress display
The CLI displays:
- Current translation stage
- Current stage percentage
- Completed and total batch count
- Status message
- Selected model
Progress is rendered by a CLI-only Rich sink. Core translation code does not write terminal output.
Errors
Expected library failures are displayed as concise errors:
Error: A Gemini API key is required.
Expected errors exit with status code 1. Typer argument validation errors
exit with status code 2.
Current limitations
The current command translates one local SRT file.
The following options are intentionally not available yet:
- Resume
- Streaming
- Audio context
- Multiple API keys
- Token reports
- Transcription
- Video or audio extraction