subtrans heartleo
Use this command to install subtrans:
winget install --id=heartleo.subtrans -e Translate SRT subtitle files using OpenAI-compatible APIs
winget install --id=heartleo.subtrans -e Translate SRT subtitle files using OpenAI-compatible APIs
使用 OpenAI API 翻译字幕文件(SRT / VTT / ASS / LRC / SBV)
Homebrew (macOS / Linux):
brew install heartleo/tap/subtrans
curl (macOS / Linux):
curl -fsSL https://raw.githubusercontent.com/heartleo/subtrans/main/install.sh | sh
Go install (需要 Go 1.25+):
go install github.com/heartleo/subtrans/cmd/subtrans@latest
从源码编译:
git clone https://github.com/heartleo/subtrans
cd subtrans
go build -o subtrans ./cmd/subtrans
# 创建env文件或设置环境变量
cat > .env <.<语言>.<原后缀>` |
| `--model` | `-m` | 模型 | - |
| `--max-batch-size` | | 每批行数 | `30` |
| `--batch-split-punct` | | 分批切分标点符号 | `.` |
| `--instructions` | | 指令文本文件路径 | - |
| `--prompt` | | 自定义用户提示词 | - |
| `--temperature` | | 温度 | `0.0` |
| `--max-retries` | | API 失败重试次数 | `3` |
| `--include-original` | | 输出中包含原文 | `false` |
| `--strip-punctuation` | | 去除译文及原文(`--include-original` 时)尾部标点 | `true` |
### subtrans serve
| 参数 | 缩写 | 说明 | 默认值 |
| -------- | ---- | -------- | ----------- |
| `--host` | | 监听地址 | `localhost` |
| `--port` | `-p` | 监听端口 | `8091` |
---
<div>
Made with ❤️ by [heartleo](https://github.com/heartleo)
</div>