CLI 快速上手
OpenASR 的 Rust CLI、本地 HTTP API 和模型目录均在 GitHub 开源仓库中维护,采用 Apache-2.0 许可证。
安装 CLI
Section titled “安装 CLI”下载预编译版本
Section titled “下载预编译版本”这是最快的安装方式。GitHub Releases 提供 macOS(arm64、x86_64)、Linux(x86_64、arm64)和 Windows(x86_64、arm64)的预编译压缩包,此外 Linux 和 Windows 还各自提供 CUDA/ROCm/Vulkan 后端变体,Linux 另有 musl 变体。下载后先用同一版本附带的 SHA256SUMS 校验文件,再解压运行:
macOS / Linux:
tar -xzf openasr-*-macos-arm64.tar.gz # 或 -macos-x86_64 / -linux-x86_64 / -linux-arm64./openasr --helpWindows:
Expand-Archive openasr-*-windows-x86_64.zip.\openasr.exe --help确认可以正常运行后,将 openasr 放到系统的 PATH 中,即可在任意目录使用。
ggml 后端以 Git 子模块提供,因此需要递归克隆仓库。编译环境需要 cmake、C/C++ 工具链,以及 rust-toolchain.toml 锁定的 Rust 1.95.0;Linux 还需要安装 libasound2-dev。
git clone --recurse-submodules https://github.com/QuintinShaw/openasr.gitcd openasrcargo build --release -p openasr-cli生成的可执行文件位于 target/release/openasr。
如果你更习惯图形界面,可以查看桌面应用指南。桌面应用是一个独立的闭源产品,与开源 CLI 分开维护。
转写第一个音频文件
Section titled “转写第一个音频文件”openasr transcribe audio.wavOpenASR 默认使用 native 后端,在本机运行 ggml 支持的 .oasr 模型包。首次使用时,如果默认模型尚未安装,CLI 会先显示模型、量化精度、文件大小、下载地址和许可证,得到确认后才会下载;安装完成后的转写可完全离线运行。
指定模型、字幕格式和输出文件:
openasr t audio.wav --model whisper-small --format srt --output audio.srtt 是 transcribe 的简写。你也可以一次处理整个目录,或同时输出多种格式:
openasr transcribe ./recordings --output ./transcriptsopenasr transcribe audio.wav --format srt --format vtt --format json如果运行过程中不允许任何网络访问,请加上 --offline。模型未安装时,命令会直接报错,不会尝试下载:
openasr transcribe audio.wav --offline查找和管理模型
Section titled “查找和管理模型”openasr search # 浏览模型目录openasr pull whisper-small # 下载并安装模型包openasr list # 查看已安装的模型包openasr show whisper-small # 查看目录信息或本地模型包详情openasr rm whisper-small # 删除已安装的模型包更多可用模型可在模型页面查看。
检查本地模型包
Section titled “检查本地模型包”下面两条命令只读取本地文件,不会下载内容,也不会运行推理:
openasr verify /path/to/model.oasropenasr show /path/to/model.oasr需要绕过已安装模型的解析流程、直接使用某个本地模型包时,可传入 --model-pack:
openasr transcribe audio.wav --model-pack /path/to/model.oasr启动本地 API
Section titled “启动本地 API”openasr serve服务启动后,可通过兼容 OpenAI 格式的转写接口调用:
curl -s http://127.0.0.1:8080/v1/audio/transcriptions \ -F model=whisper-small \ -F response_format=json转写请求只会使用已经安装或通过 --model-pack 明确指定的本地模型,不会在请求过程中自动下载模型。
认证、TLS 和远程访问配置见本地服务 API。
排查环境问题
Section titled “排查环境问题”openasr doctor完整命令说明见 CLI 参考。当前版本实际支持的参数以 openasr --help 和 openasr <command> --help 为准。