Skip to content

Commit d4fa20e

Browse files
Merge pull request #265 from DeepLcom/add-deepl-cli-docs
[REDO] Add DeepL CLI documentation to Getting Started
2 parents 451def4 + b4f2098 commit d4fa20e

3 files changed

Lines changed: 146 additions & 1 deletion

File tree

docs.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@
4141
"docs/getting-started/about",
4242
"docs/getting-started/auth",
4343
"docs/getting-started/regional-endpoints",
44-
"docs/getting-started/client-libraries",
44+
{
45+
"group": "Developer Tools",
46+
"pages": [
47+
"docs/getting-started/client-libraries",
48+
"docs/getting-started/deepl-cli"
49+
]
50+
},
4551
"docs/getting-started/managing-api-keys",
4652
"docs/getting-started/your-first-api-request",
4753
"docs/getting-started/test-your-api-requests-with-postman",
@@ -393,6 +399,10 @@
393399
"source": "/api-reference/client-libraries",
394400
"destination": "/docs/getting-started/client-libraries"
395401
},
402+
{
403+
"source": "/docs/cli",
404+
"destination": "/docs/getting-started/deepl-cli"
405+
},
396406
{
397407
"source": "/docs/resources/release-notes/rss.xml",
398408
"destination": "/docs/resources/roadmap-and-release-notes/rss.xml"

docs/getting-started/client-libraries.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Features include:
3535

3636
All officially supported client libraries are open-source under the MIT License. We welcome feedback in the form of issues and pull requests!
3737

38+
## Command-line interface
39+
40+
For terminal-based workflows, scripting, and CI/CD pipelines, see the [DeepL CLI](/docs/getting-started/deepl-cli).
41+
3842
## Community-created client libraries
3943

4044
The DeepL community [maintains client libraries](https://github.com/DeepLcom/awesome-deepl?tab=readme-ov-file#community-libraries--sdks) for other languages, including [Dart](https://github.com/komape/deepl_dart), [Go](https://github.com/candy12t/go-deepl), [Rust](https://github.com/Avimitin/deepl-rs), and [Kotlin](https://github.com/SimplyMika/DeeplKt).

docs/getting-started/deepl-cli.mdx

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
title: "DeepL CLI"
3+
description: "Install and use the DeepL CLI to translate text, documents, and more from your terminal."
4+
public: true
5+
---
6+
7+
**This page shows you:**
8+
- How to install the DeepL CLI from source
9+
- How to authenticate and run your first translation
10+
- What commands are available for translation, writing, voice, and more
11+
12+
The [DeepL CLI](https://github.com/DeepLcom/deepl-cli) is an open-source (MIT license) command-line tool for interacting with the DeepL API. It covers text translation, document translation, writing enhancement, voice translation, glossary management, and admin operations — all from your terminal.
13+
14+
## Installation
15+
16+
<Note>
17+
The CLI requires [Node.js](https://nodejs.org/) (v18+) and build tools for native compilation:
18+
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
19+
- **Linux**: `python3`, `make`, `gcc` (`apt install python3 make gcc g++`)
20+
- **Windows**: Visual Studio Build Tools
21+
</Note>
22+
23+
```bash
24+
git clone https://github.com/DeepLcom/deepl-cli.git
25+
cd deepl-cli
26+
npm install
27+
npm run build
28+
npm link
29+
30+
deepl --version
31+
```
32+
33+
## Quick start
34+
35+
### 1. Set up authentication
36+
37+
Use the interactive setup wizard:
38+
39+
```bash
40+
deepl init
41+
```
42+
43+
Or set your API key directly:
44+
45+
```bash
46+
deepl auth set-key YOUR_API_KEY
47+
```
48+
49+
Or use an environment variable:
50+
51+
```bash
52+
export DEEPL_API_KEY=YOUR_API_KEY
53+
```
54+
55+
### 2. Translate text
56+
57+
```bash
58+
deepl translate "Hello, world!" --to es
59+
# ¡Hola, mundo!
60+
```
61+
62+
### 3. Enhance your writing
63+
64+
```bash
65+
deepl write "Their going to the stor tommorow" --lang en-us
66+
# They're going to the store tomorrow.
67+
```
68+
69+
## Key capabilities
70+
71+
| Command | Description |
72+
|---------|-------------|
73+
| `deepl translate` | Translate text with support for formality, context, and custom instructions |
74+
| `deepl translate --file` | Translate text files while preserving code blocks and formatting |
75+
| `deepl document` | Translate documents (PDF, DOCX, PPTX, XLSX) with format preservation |
76+
| `deepl write` | Enhance grammar and style via DeepL Write |
77+
| `deepl voice` | Stream real-time speech translation via WebSocket |
78+
| `deepl watch` | Monitor files and auto-translate on change |
79+
| `deepl glossary` | Create, list, and manage glossaries |
80+
| `deepl admin` | Manage API keys, usage limits, and team access |
81+
| `deepl usage` | Check API usage and character quotas |
82+
| `deepl config` | Configure defaults (target language, formality, model) |
83+
84+
## Usage examples
85+
86+
### Translate with context and formality
87+
88+
```bash
89+
deepl translate "Thank you for your patience" --to de --formality more \
90+
--context "Customer support email to a long-standing client"
91+
```
92+
93+
### Translate a document
94+
95+
```bash
96+
deepl document translate report.pdf --to fr --output report-fr.pdf
97+
```
98+
99+
### Batch translate a directory
100+
101+
```bash
102+
deepl translate --file src/locales/en/ --to de,fr,es --output src/locales/
103+
```
104+
105+
### Watch mode for development
106+
107+
```bash
108+
deepl watch ./content/en --to de,fr --output ./content/
109+
```
110+
111+
### Git hooks integration
112+
113+
Automatically translate changed files before each commit:
114+
115+
```bash
116+
deepl hooks install --pre-commit --languages de,fr
117+
```
118+
119+
## Developer workflow features
120+
121+
- Local SQLite cache with LRU eviction avoids redundant API calls
122+
- Monitor billed characters for budget planning with `deepl usage`
123+
- Use `--quiet` and `--no-input` flags for CI/CD pipelines
124+
- Generate shell completions for bash, zsh, fish, and PowerShell
125+
126+
## Further reading
127+
128+
- [DeepL CLI on GitHub](https://github.com/DeepLcom/deepl-cli) — full documentation, changelog, and source code
129+
- [DeepL API authentication](/docs/getting-started/auth) — set up your API key
130+
- [Your first API request](/docs/getting-started/your-first-api-request) — understand how the API works
131+
- [Client libraries](/docs/getting-started/client-libraries) — official SDKs for six languages

0 commit comments

Comments
 (0)