|
| 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