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