Skip to content

Commit 299e3f5

Browse files
authored
Merge pull request #32 from DeepLcom/feat/free-key-endpoint-resolution
feat: free key endpoint resolution and custom/regional URL support
2 parents 2be9efc + 16f240e commit 299e3f5

32 files changed

Lines changed: 1864 additions & 1242 deletions

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Free API key (`:fx` suffix) support with automatic endpoint resolution to `api-free.deepl.com`
13+
- Shared endpoint resolver used by all commands including voice, auth, and init
14+
- Custom/regional endpoint support (e.g. `api-jp.deepl.com`) that takes priority over auto-detection
15+
16+
### Changed
17+
18+
- Voice API no longer hardcodes the Pro endpoint; it follows the same endpoint resolution as all other commands
19+
- `auth set-key` and `init` now validate entered keys against the correct endpoint based on key suffix
20+
- Standard DeepL URLs (`api.deepl.com`, `api-free.deepl.com`) in saved config no longer override key-based auto-detection
21+
1022
### Security
23+
1124
- Updated `minimatch` from `^9.0.5` to `^10.2.1` to fix ReDoS vulnerability (GHSA-3ppc-4f35-3m26)
1225

1326
## [1.0.0] - 2026-02-17
1427

1528
### Added
29+
1630
- Text translation via DeepL's next-generation LLM (`deepl translate`)
1731
- Document translation for PDF, DOCX, PPTX, XLSX, HTML, SRT, XLIFF, and images with formatting preservation
1832
- Structured file translation for JSON and YAML i18n locale files (keys, nesting, comments preserved)
@@ -42,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4256
- Advanced XML/HTML tag handling with splitting, non-splitting, and ignore tags
4357

4458
### Security
59+
4560
- HTTPS enforcement for all API communication (localhost exempted for testing)
4661
- Symlink rejection on all file-reading paths to prevent directory traversal
4762
- API key masking in logs, config output, and error messages
@@ -50,4 +65,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5065
- Atomic writes for translated output and config files to prevent corruption
5166

5267
### Changed
68+
5369
- Requires Node.js >= 20

README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ deepl --version
7373
```
7474

7575
> **Note:** This project uses [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3) for local caching, which requires native compilation. If `npm install` fails with build errors, ensure you have:
76+
>
7677
> - **macOS**: Xcode Command Line Tools (`xcode-select --install`)
7778
> - **Linux**: `python3`, `make`, and `gcc` (`apt install python3 make gcc g++`)
7879
> - **Windows**: Visual Studio Build Tools or `windows-build-tools` (`npm install -g windows-build-tools`)
@@ -119,13 +120,13 @@ deepl translate "Hello, world!" --to es
119120

120121
DeepL CLI supports global flags that work with all commands:
121122

122-
| Flag | Short | Description |
123-
|------|-------|-------------|
124-
| `--version` | `-V` | Show version number |
125-
| `--quiet` | `-q` | Suppress non-essential output |
126-
| `--verbose` | `-v` | Show extra information |
127-
| `--config FILE` | `-c` | Use alternate configuration file |
128-
| `--no-input` | | Disable all interactive prompts (abort instead of prompting) |
123+
| Flag | Short | Description |
124+
| --------------- | ----- | ------------------------------------------------------------ |
125+
| `--version` | `-V` | Show version number |
126+
| `--quiet` | `-q` | Suppress non-essential output |
127+
| `--verbose` | `-v` | Show extra information |
128+
| `--config FILE` | `-c` | Use alternate configuration file |
129+
| `--no-input` | | Disable all interactive prompts (abort instead of prompting) |
129130

130131
### Verbose Mode
131132

@@ -222,12 +223,12 @@ $ deepl -c /path/to/test-config.json usage
222223

223224
The CLI follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/latest/):
224225

225-
| Priority | Condition | Config path | Cache path |
226-
|----------|-----------|-------------|------------|
227-
| 1 | `DEEPL_CONFIG_DIR` set | `$DEEPL_CONFIG_DIR/config.json` | `$DEEPL_CONFIG_DIR/cache.db` |
228-
| 2 | `~/.deepl-cli/` exists | `~/.deepl-cli/config.json` | `~/.deepl-cli/cache.db` |
229-
| 3 | XDG env vars set | `$XDG_CONFIG_HOME/deepl-cli/config.json` | `$XDG_CACHE_HOME/deepl-cli/cache.db` |
230-
| 4 | Default | `~/.config/deepl-cli/config.json` | `~/.cache/deepl-cli/cache.db` |
226+
| Priority | Condition | Config path | Cache path |
227+
| -------- | ---------------------- | ---------------------------------------- | ------------------------------------ |
228+
| 1 | `DEEPL_CONFIG_DIR` set | `$DEEPL_CONFIG_DIR/config.json` | `$DEEPL_CONFIG_DIR/cache.db` |
229+
| 2 | `~/.deepl-cli/` exists | `~/.deepl-cli/config.json` | `~/.deepl-cli/cache.db` |
230+
| 3 | XDG env vars set | `$XDG_CONFIG_HOME/deepl-cli/config.json` | `$XDG_CACHE_HOME/deepl-cli/cache.db` |
231+
| 4 | Default | `~/.config/deepl-cli/config.json` | `~/.cache/deepl-cli/cache.db` |
231232

232233
Existing `~/.deepl-cli/` installations continue to work with no changes needed.
233234

@@ -942,6 +943,7 @@ deepl languages
942943
```
943944

944945
**Note:** Languages are grouped into three categories:
946+
945947
- **Core** (32) — Full feature support including formality and glossaries
946948
- **Regional** (7) — Target-only variants: `en-gb`, `en-us`, `es-419`, `pt-br`, `pt-pt`, `zh-hans`, `zh-hant`
947949
- **Extended** (82) — Only support `quality_optimized` model, no formality or glossary
@@ -957,7 +959,7 @@ Configuration is stored in `~/.config/deepl-cli/config.json` (or `~/.deepl-cli/c
957959
deepl config list
958960
# {
959961
# "auth": { "apiKey": "..." },
960-
# "api": { "baseUrl": "https://api-free.deepl.com/v2", ... },
962+
# "api": { "baseUrl": "https://api.deepl.com", "usePro": true, ... },
961963
# "cache": { "enabled": true, "maxSize": 1073741824, "ttl": 2592000 },
962964
# ...
963965
# }
@@ -1444,15 +1446,15 @@ npm run examples:fast
14441446

14451447
## 🌐 Environment Variables
14461448

1447-
| Variable | Description |
1448-
|----------|-------------|
1449-
| `DEEPL_API_KEY` | API authentication key |
1450-
| `DEEPL_CONFIG_DIR` | Override config and cache directory |
1451-
| `XDG_CONFIG_HOME` | Override XDG config base (default: `~/.config`) |
1452-
| `XDG_CACHE_HOME` | Override XDG cache base (default: `~/.cache`) |
1453-
| `NO_COLOR` | Disable colored output |
1454-
| `FORCE_COLOR` | Force colored output even when terminal doesn't support it. Useful in CI. `NO_COLOR` takes priority if both are set. |
1455-
| `TERM=dumb` | Disables colored output and progress spinners. Automatically set by some CI environments and editors. |
1449+
| Variable | Description |
1450+
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
1451+
| `DEEPL_API_KEY` | API authentication key |
1452+
| `DEEPL_CONFIG_DIR` | Override config and cache directory |
1453+
| `XDG_CONFIG_HOME` | Override XDG config base (default: `~/.config`) |
1454+
| `XDG_CACHE_HOME` | Override XDG cache base (default: `~/.cache`) |
1455+
| `NO_COLOR` | Disable colored output |
1456+
| `FORCE_COLOR` | Force colored output even when terminal doesn't support it. Useful in CI. `NO_COLOR` takes priority if both are set. |
1457+
| `TERM=dumb` | Disables colored output and progress spinners. Automatically set by some CI environments and editors. |
14561458

14571459
See [docs/API.md#environment-variables](./docs/API.md#environment-variables) for full details.
14581460

0 commit comments

Comments
 (0)