dtrans
A modern command-line translator powered by LLMs.
Note: This is a ground-up rewrite of translate-shell with a focus on LLM-based translation and a significantly improved CLI experience.
Features
- LLM-powered translation via DeepSeek, Gemini, a ChatGPT subscription, or any OpenAI-compatible API
- Verify your translations with alternatives, comparisons, and contextual examples
- Rich terminal UI with beautiful panels, tables, and spinners
- Modern CLI with explicit long-form flags and intuitive language syntax
- Configurable providers via a simple TOML config file
Installation
pipx install dtrans
Or with pip:
pip install dtrans
Quick Start
- Create your configuration file at
~/.config/dtrans/config.toml:
default_provider = "deepseek"
[providers.deepseek]
api_key = "sk-..."
model = "deepseek-chat"
[providers.openai]
api_key = "sk-..."
model = "gpt-4o"
[providers.gemini]
api_key = "..."
model = "gemini-1.5-flash"
[providers.chatgpt]
provider_type = "chatgpt"
# Optional: omit model to use the Codex default available to your subscription.
# model = "your-codex-model"
To use the chatgpt provider, install the
Codex CLI and sign in through its supported browser
flow. dtrans delegates authentication and token refresh to Codex and never reads its cached
credentials:
dtrans-auth login
dtrans-auth status
# For remote or headless systems
dtrans-auth login --device-auth
- Translate:
# Auto-detect source, translate to French
dtrans --to fr "Hello, world!"
# Specify source and target
dtrans en:fr "Hello, world!"
# Brief mode (translation text only)
dtrans --brief "Hello, world!"
# Identify language
dtrans --identify "手紙"
Usage
Usage: dtrans [OPTIONS] TEXT
Options:
--from TEXT Source language code (e.g. 'en', 'ja'). Omit to auto-detect.
--to TEXT Target language code (e.g. 'fr', 'zh'). Defaults to system locale.
--provider TEXT Override the default provider from the config file.
--brief / --verbose
Brief mode prints only the translation. Verbose is the default in a TTY.
--identify Identify the source language and exit.
--version Show version and exit.
--help Show this message and exit.
Language Syntax
| Pattern | Meaning |
|---|---|
:fr |
Auto-detect source → French |
ja: |
Japanese → default target |
en:fr |
English → French |
Custom Providers
Any OpenAI-compatible API can be configured:
[providers.local]
base_url = "http://localhost:11434/v1"
api_key = "ollama"
model = "llama3"
Development
# Clone
git clone https://github.com/kriss-spy/deep-translate-shell.git
cd deep-translate-shell
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check src tests
mypy src
License
See LICENSE.
Metadata
Release files for dtrans 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dtrans-1.1.0.tar.gz | 100.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dtrans-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.8 kB
Release files / dtrans-1.1.0.tar.gz
| Download URL | dtrans-1.1.0.tar.gz |
|---|---|
| Size | 100.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8e66335fdf2eae4031e902d5f9de9d8f005c9870df5bef99c98aa7bc1f151a3
|
|
BLAKE2b-256 checksum How to use checksums |
195bf4540eb6f677b9110a9a5a629d98dde57c87069aec7eb0cd3acb0a3765f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / dtrans-1.1.0-py3-none-any.whl
| Download URL | dtrans-1.1.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfc3dfbc726bd10127e179e1f827bad9f2697ce8d091b760d5038b1b6a7e032b
|
|
BLAKE2b-256 checksum How to use checksums |
1596c05070a22de8236b20dc719580076b8f24bda8ea0e815bffe64bd1a1e46e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log