gladia-using-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gladia CLI

Gladia CLI

The Gladia CLI (
gladia
) transcribes pre-recorded audio from the terminal. Local files are auto-uploaded; URLs are passed directly to the API.
CLI vs SDK: use the CLI for quick terminal workflows when
gladia
is on PATH. For app integration or audio intelligence not exposed as CLI flags, see gladia-sdk-integration and gladia-audio-intelligence.
Gladia CLI
gladia
)可在终端中转录预录制音频。本地文件会自动上传;URL则直接传递至API。
CLI vs SDK:当
gladia
已在PATH中时,使用CLI完成快速终端工作流。如需应用集成或CLI参数未暴露的音频智能功能,请查看gladia-sdk-integrationgladia-audio-intelligence

When to Use

使用场景

  • User mentions gladia-cli,
    gladia transcribe
    , or wants quick terminal transcription
  • Agent should transcribe a local file or URL, then answer follow-up questions about the content
  • One-off transcription without writing application code
Prerequisites: verify
gladia --version
succeeds and an API key is configured (
GLADIA_API_KEY
,
~/.gladia
, or
--gladia-key
).
  • 用户提及gladia-cli、
    gladia transcribe
    ,或需要快速终端转录
  • Agent需转录本地文件或URL,随后回答关于内容的跟进问题
  • 无需编写应用代码的一次性转录
前置条件:确认
gladia --version
执行成功,且已配置API密钥(通过
GLADIA_API_KEY
环境变量、
~/.gladia
文件或
--gladia-key
参数)。

When NOT to Use

不适用场景

  • Live / real-time audio — use gladia-live-transcription
  • Building an app or CI pipeline in code — use gladia-sdk-integration
  • Audio intelligence not in CLI (translation, summarization, NER, PII, audio-to-LLM) — use gladia-audio-intelligence with the SDK
  • 实时音频 —— 使用gladia-live-transcription
  • 在代码中构建应用或CI流水线 —— 使用gladia-sdk-integration
  • CLI未支持的音频智能功能(翻译、摘要提取、命名实体识别(NER)、个人可识别信息(PII)、音频转大语言模型)—— 使用搭配SDK的gladia-audio-intelligence

References

参考资料

Consult these resources as needed:
  • ./references/cli-vs-sdk.md -- CLI vs SDK routing: which features have CLI flags and which require SDK skills
  • ../gladia-pre-recorded-transcription/SKILL.md -- SDK pre-recorded workflow and options
  • ../gladia-audio-intelligence/SKILL.md -- Addons beyond CLI flags
  • ../gladia-troubleshooting/SKILL.md -- API key, upload, and polling errors
  • gladia-cli repository
按需查阅以下资源:
  • ./references/cli-vs-sdk.md -- CLI与SDK的功能划分:哪些功能有CLI参数,哪些需要SDK技能
  • ../gladia-pre-recorded-transcription/SKILL.md -- SDK预录制工作流及选项
  • ../gladia-audio-intelligence/SKILL.md -- CLI参数之外的附加功能
  • ../gladia-troubleshooting/SKILL.md -- API密钥、上传及轮询错误排查
  • gladia-cli仓库

Setup

安装配置

Install (macOS/Linux):
bash
curl -fsSL https://github.com/gladiaio/gladia-cli/releases/latest/download/install.sh | sh
Auth — get a key at app.gladia.io/account. Three options:
bash
undefined
安装(macOS/Linux):
bash
curl -fsSL https://github.com/gladiaio/gladia-cli/releases/latest/download/install.sh | sh
认证 —— 在app.gladia.io/account获取密钥。三种配置方式:
bash
undefined

1. Environment variable (preferred for CI and shells)

1. 环境变量(CI和Shell环境首选)

export GLADIA_API_KEY=<API_KEY>
export GLADIA_API_KEY=<API_KEY>

2. Persist locally

2. 本地持久化存储

gladia auth set <API_KEY>
gladia auth set <API_KEY>

3. Pass per command (global flag, works on any command)

3. 单命令传递(全局参数,适用于所有命令)

gladia transcribe meeting.wav --gladia-key <API_KEY>

**Credential order:** `GLADIA_API_KEY` → `~/.gladia` → `--gladia-key` (first match wins)

**List valid language codes:** `gladia languages`
gladia transcribe meeting.wav --gladia-key <API_KEY>

**凭证优先级**:`GLADIA_API_KEY` → `~/.gladia` → `--gladia-key`(匹配到第一个即生效)

**查看有效语言代码**:`gladia languages`

Commands

命令列表

CommandDescription
gladia transcribe <source>
Transcribe a local file or
http(s)
URL
gladia auth set <key>
Save API key to
~/.gladia
gladia languages
List supported ISO 639-1 codes
命令描述
gladia transcribe <source>
转录本地文件或
http(s)
URL音频
gladia auth set <key>
将API密钥保存至
~/.gladia
文件
gladia languages
列出支持的ISO 639-1语言代码

Transcribe Flags

转录参数

FlagDefaultDescription
-o
,
--output
text
text
,
json
,
json-full
,
srt
,
vtt
--language
Expected language(s), comma-separated (
en
or
en,fr,de
)
--code-switching
,
--code-switch
offDetect language per utterance
--diarize
offSpeaker identification
--model
API default
solaria-1
or
solaria-3
-v
,
--verbose
offShow progress while polling
Global:
--gladia-key
— API key override
参数默认值描述
-o
,
--output
text
输出格式:
text
json
json-full
srt
vtt
--language
指定预期语言(可逗号分隔,如
en
en,fr,de
--code-switching
,
--code-switch
off检测每段语音的语言(代码切换)
--diarize
off说话人识别
--model
API默认值选择模型:
solaria-1
solaria-3
-v
,
--verbose
off轮询时显示进度
全局参数:
--gladia-key
—— 覆盖已配置的API密钥

Agent Workflow: Transcribe Then Q&A

Agent工作流:转录后问答

  1. Check CLI
    gladia --version
    ; install or use SDK skills if missing
  2. Pick flags — match output format and options to the user's question (tables below)
  3. Run
    gladia transcribe <source> [flags]
    ; capture stdout
  4. Answer — ground responses only in captured output; cite speakers and timestamps when available
  5. Re-run if needed — if the question requires data not in the current output (e.g. timestamps, speakers), re-transcribe with different flags
  6. Long audio — use
    -v
    for progress; for very long transcripts, redirect stdout to a temp file and read selectively
Do not invent transcript content. If output is empty or unclear, say so and suggest different flags or SDK skills.
  1. 检查CLI —— 执行
    gladia --version
    ;若未安装则安装或改用SDK技能
  2. 选择参数 —— 根据用户问题匹配输出格式及选项(见下方表格)
  3. 执行命令 —— 运行
    gladia transcribe <source> [flags]
    ;捕获标准输出
  4. 回答问题 —— 仅基于捕获的输出进行回复;若有说话人及时间戳信息需引用
  5. 按需重新执行 —— 若问题需要当前输出未包含的数据(如时间戳、说话人信息),则使用不同参数重新转录
  6. 长音频处理 —— 使用
    -v
    参数查看进度;对于超长转录内容,可将标准输出重定向至临时文件并选择性读取
请勿编造转录内容。若输出为空或不清晰,请如实告知并建议使用不同参数或SDK技能。

Output Format Selection

输出格式选择

User needCLI approach
Plain transcriptdefault or
-o text
Who spoke when
--diarize -o text
or
-o json
Timestamps per utterance
-o json
(utterance list with
time_begin
,
time_end
)
Full API payload
-o json-full
Subtitle file
-o srt
or
-o vtt
(add
--diarize
for speaker labels)
Model choice
--model solaria-1
or
--model solaria-3
用户需求CLI实现方式
纯文本转录稿默认格式或
-o text
说话人及对应时间
--diarize -o text
-o json
每段语音的时间戳
-o json
(包含
time_begin
time_end
的语音列表)
完整API返回数据
-o json-full
字幕文件
-o srt
-o vtt
(添加
--diarize
可包含说话人标签)
模型选择
--model solaria-1
--model solaria-3

Language behavior

语言处理行为

You can list all the possible languages compatible with gladia with the command
gladia languages
.
GoalCommand
Auto-detect
gladia transcribe <source>
Constrain detection
--language en,fr,de
(does not enable code switching)
Code switching
--code-switching
(+ optional
--language
hints)
可通过
gladia languages
命令查看Gladia支持的所有语言。
目标命令
自动检测语言
gladia transcribe <source>
限定检测语言范围
--language en,fr,de
启用代码切换功能)
代码切换(多语言检测)
--code-switching
(可搭配
--language
参数提供提示)

CLI vs SDK (summary)

CLI与SDK对比(摘要)

For full CLI vs SDK routing, see ./references/cli-vs-sdk.md.
FeatureCLIIf not in CLI
Basic transcription
gladia transcribe
Speaker diarization
--diarize
gladia-audio-intelligence for advanced config
Language / code-switch
--language
,
--code-switching
SDK for advanced
language_config
Translation, NER, PII, sentiment, audio-to-LLMNogladia-audio-intelligence
API summarization addonNoSDK (agent may summarize
-o text
output informally)
Live streamingNogladia-live-transcription
如需完整的CLI与SDK功能划分,请查看./references/cli-vs-sdk.md
功能CLI支持情况CLI不支持时的替代方案
基础转录
gladia transcribe
支持
说话人分离
--diarize
参数支持
高级配置请使用gladia-audio-intelligence
语言设置/代码切换
--language
--code-switching
参数支持
高级
language_config
配置请使用SDK
翻译、命名实体识别、个人可识别信息分析、情感分析、音频转大语言模型不支持使用gladia-audio-intelligence
API摘要附加功能不支持使用SDK(Agent可对
-o text
输出进行非正式摘要)
实时流转录不支持使用gladia-live-transcription

Examples

示例

bash
gladia transcribe meeting.wav
gladia transcribe https://example.com/podcast.mp3 -o json
gladia transcribe call.wav --diarize -o srt
gladia transcribe interview.mp3 --language en,fr --code-switching -v
gladia transcribe podcast.mp3 --model solaria-1 -o json-full
gladia transcribe meeting.wav --gladia-key <API_KEY>   # inline key, no env or ~/.gladia needed
bash
gladia transcribe meeting.wav
gladia transcribe https://example.com/podcast.mp3 -o json
gladia transcribe call.wav --diarize -o srt
gladia transcribe interview.mp3 --language en,fr --code-switching -v
gladia transcribe podcast.mp3 --model solaria-1 -o json-full
gladia transcribe meeting.wav --gladia-key <API_KEY>   # 内联密钥,无需环境变量或~/.gladia文件

Common Mistakes

常见错误

  • Treating
    --language en,fr
    as code-switching
    — it only constrains detection; add
    --code-switching
    separately for per-utterance language detection
  • Answering without re-running — timestamp or speaker questions need
    -o json
    or
    --diarize
    ; plain text may lack required fields
  • Inventing CLI flags — translation, summarization, NER, and PII have no CLI flags today; route to SDK skills
  • Using SDK code when CLI is requested — if the user has
    gladia
    installed and wants terminal workflow, run shell commands
  • Skipping auth check — transcription fails without a valid API key in env,
    ~/.gladia
    , or
    --gladia-key
For API errors and diagnostics, see gladia-troubleshooting.
  • --language en,fr
    视为代码切换
    —— 该参数仅限定检测范围;需单独添加
    --code-switching
    才能实现逐段语音的语言检测
  • 未重新执行命令就回答问题 —— 涉及时间戳或说话人的问题需要
    -o json
    --diarize
    参数;纯文本输出可能缺少所需字段
  • 编造CLI参数 —— 翻译、摘要、命名实体识别、个人可识别信息分析目前无CLI参数;请引导至SDK技能
  • 用户要求CLI时使用SDK代码 —— 若用户已安装
    gladia
    并需要终端工作流,请执行Shell命令
  • 跳过认证检查 —— 若环境变量、
    ~/.gladia
    文件或
    --gladia-key
    参数中无有效API密钥,转录会失败
API错误及诊断请查看gladia-troubleshooting

Further Reading

延伸阅读