Skip to main content

Minimalist AI translation CLI powered by LLMs

Project description

🌐 Other languages

🌿 Mint

Minimalist AI Translation CLI — Simple. Fast. Intuitive.

GitHub Release PyPI npm codecov

Mint is a single-binary, LLM-powered translation CLI. Set two environment variables and translate anything from the command line — files, piped output, or inline text. Built-in language detection, grammar correction, streaming output, and multi-language rotation.

export MINT_PROVIDER=google-genai
export MINT_API_KEY=your_key

mint -t ja "Good morning"         # おはようございます
echo "早安" | mint -t en          # Good morning
cat document.txt | mint -t fr     # translate a whole file

✨ Why Mint?

  • Zero-config — Single binary; API keys via env vars, no config file pollution
  • Multi-provider — Google Gemini, OpenAI, Anthropic, or local Ollama / LM Studio
  • Smart detection — Auto-detects language on every call; language-neutral content (numbers, symbols) passes through unchanged
  • Smart correction — Same-language input? Auto-corrects grammar & spelling instead of translating
  • Streaming — Output streams in real-time, no waiting for long translations
  • Composable — Pipe-friendly stdin/stdout; pairs seamlessly with grep, sed, xargs, and friends
  • Secure — Untrusted input is isolated from model instructions via system/user message separation and per-request random-nonce delimiters; translating adversarial content cannot hijack the LLM's behavior

📋 Installation

Automated install (recommended)

macOS / Linux

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/min0625/mint/main/script/install.sh)"

Auto-detects OS and architecture (Linux/macOS, x86_64/arm64), installs to ~/.local/bin. Override with MINT_INSTALL_DIR or pin a version with MINT_VERSION=v1.0.0.

Windows (PowerShell)

irm https://raw.githubusercontent.com/min0625/mint/main/script/install.ps1 | iex

Auto-detects architecture (x86_64/arm64) and installs to $HOME\.local\bin. Override with $env:MINT_INSTALL_DIR or pin a version with $env:MINT_VERSION = 'v1.0.0'.

Homebrew (macOS / Linux)

brew install min0625/tap/mint-ai

pipx

pipx install mint-ai

npm

npm install -g mint-ai

Manual download

Download the pre-built binary for your platform from GitHub Releases, move it into a directory on your PATH, then verify:

mint --version

🚀 Quick Start

1. Set your provider

# Google Gemini (free tier available — https://aistudio.google.com/apikey)
export MINT_PROVIDER=google-genai
export MINT_API_KEY=your_gemini_api_key

# OpenAI
export MINT_PROVIDER=openai
export MINT_API_KEY=sk-...

# Anthropic
export MINT_PROVIDER=anthropic
export MINT_API_KEY=sk-ant-...

# Ollama (no API key needed)
export MINT_PROVIDER=openai
export MINT_BASE_URL=http://localhost:11434
export MINT_MODEL_NAME=qwen2.5:7b  # use any model loaded in Ollama

# LM Studio (no API key needed)
export MINT_PROVIDER=openai
export MINT_BASE_URL=http://localhost:1234
export MINT_MODEL_NAME=lmstudio-community/Qwen2.5-7B-Instruct-GGUF  # use any model loaded in LM Studio

2. Translate

mint --target ja "Good morning"
mint -t zh-TW "Good morning"

echo "The quick brown fox" | mint -t fr
cat document.txt | mint -t zh-TW

Use --verbose / -v (or MINT_VERBOSE=true) to print diagnostic info and token usage to stderr:

mint -t ja -v "Good morning"
# [mint] provider: google-genai
# [mint] model: gemini-3.1-flash-lite
# [mint] single target — skipping language detection
# [mint] target language: ja
# おはようございます
# [mint] tokens: 113 in / 2 out

Typical token usage (measured on gemini-3.1-flash-lite):

Mode Input Calls Input tokens Output tokens
Single-target (-t or single MINT_TARGET_LANG) short word/sentence 1 ~110–130 ~1–15
Single-target long article (testdata/sample.txt) 1 ~465–470 ~450–560
Multi-target rotation (comma-separated MINT_TARGET_LANG) short sentence 2 ~250–260 ~2–8
Explicit source -s + rotation short sentence 1 ~105–120 ~1–2

Token counts scale with input length. Output tokens vary by target language — Japanese and Chinese tend to produce more tokens than English for equivalent content.

How far does 1M tokens go? (input + output combined, derived from the measured usage above):

Input ~Tokens per translation Translations per 1M tokens
Short word or phrase ~120 ~8,000
300-word article ~1,000 ~1,000

Counts combine input and output tokens. Providers price input and output separately and many offer free tiers — check your provider's pricing page for current rates. Google Gemini's free tier at Google AI Studio needs no credit card.

Force the source language with --source / -s to translate input that is also valid in the target language (cross-language homographs, romanized text):

mint -s fr -t en "pain"          # French → bread (without -s, treated as English "pain")
mint -s ja -t en "konnichiwa"    # romaji Japanese → hello

3. Smart language detection

Translation with auto-detection:

export MINT_TARGET_LANG=en

mint "早安"   # Detects Chinese → Good morning

Grammar & spelling correction — when input language matches the target, Mint corrects instead of translates:

export MINT_TARGET_LANG=en

mint "Good mooorning"          # Detects English → Good morning
mint "She don't know nothing"  # Detects English → She doesn't know anything
mint "i luv coding"            # Detects English → I love coding

Language rotation — translates to the next language in the list, wrapping around:

# Two languages
export MINT_TARGET_LANG=en,zh-TW
mint "Hello"   # en → zh-TW: 你好
mint "你好"    # zh-TW → en: Hello

# Three languages
export MINT_TARGET_LANG=en,zh-TW,ja
mint "Hello"       # en → zh-TW: 你好
mint "你好"        # zh-TW → ja: こんにちは
mint "こんにちは"   # ja → en: Hello

🔑 Environment Variables

Variable Description Default
MINT_PROVIDER google-genai | openai | anthropic — (required)
MINT_API_KEY API key; required when using the default endpoint; optional when MINT_BASE_URL is set (proxy handles auth)
MINT_BASE_URL Custom API base URL (domain only; each provider appends its own path); use with openai to target Ollama (http://localhost:11434), LM Studio (http://localhost:1234), or any other OpenAI-compatible endpoint Provider default
MINT_MODEL_NAME Model to use; required when MINT_BASE_URL is set gemini-3.1-flash-lite / gpt-4o-mini / claude-haiku-4-5
MINT_TARGET_LANG Target language(s), e.g. en or en,zh-TW,ja System locale
MINT_VERBOSE Set to true to enable verbose diagnostic output (equivalent to --verbose) false

🚩 CLI Flags

Flag Short Description
--target <lang> -t Target language (BCP-47 tag, e.g. ja, zh-TW, fr). Overrides MINT_TARGET_LANG.
--source <lang> -s Source language (BCP-47 tag); skips auto-detection and forces translation from this language.
--verbose -v Print diagnostic info and token usage to stderr. Also enabled by MINT_VERBOSE=true.
--version Print version and exit.

📅 Roadmap

  • Multi-LLM provider support (Google Gemini, OpenAI, Anthropic, local via Ollama / LM Studio)
  • Smart language detection and multi-language rotation via MINT_TARGET_LANG
  • Explicit target language via --target / -t flag
  • Explicit source language via --source / -s flag
  • Streaming output
  • GoReleaser multi-platform binary release (Linux / macOS / Windows)
  • Batch translation mode
  • Glossary / custom dictionary support
  • Output format options (plain text, JSON, Markdown)
  • Caching for repeated translations

📄 License

Apache License 2.0 — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mint_ai-0.0.8-py3-none-win_arm64.whl (2.7 MB view details)

Uploaded Python 3Windows ARM64

mint_ai-0.0.8-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

mint_ai-0.0.8-py3-none-musllinux_1_2_x86_64.whl (3.0 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

mint_ai-0.0.8-py3-none-musllinux_1_2_aarch64.whl (2.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

mint_ai-0.0.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

mint_ai-0.0.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

mint_ai-0.0.8-py3-none-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

mint_ai-0.0.8-py3-none-macosx_10_9_x86_64.whl (3.0 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file mint_ai-0.0.8-py3-none-win_arm64.whl.

File metadata

  • Download URL: mint_ai-0.0.8-py3-none-win_arm64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mint_ai-0.0.8-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 0ba954521195abbad18088a1bf84e5ba176217c688b23bad205c2c710818ce31
MD5 05ec0ecc5ca9a8a434f4dffc9295ff3e
BLAKE2b-256 297aba150cfda120ed0f632e104435d3f4e7f6da89b607b2b74b36e94d5acaca

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-win_arm64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-win_amd64.whl.

File metadata

  • Download URL: mint_ai-0.0.8-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mint_ai-0.0.8-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ec797ffcf643a87bcadd043bda496e4a33697c10de2a20d6dd121d3a1984229e
MD5 a8b7fa6946194efb774a8db55477d3b9
BLAKE2b-256 d6e8886c11d0b72ea1335f7c906cff2647967ea25805267f04abbbcd70f5d0f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-win_amd64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0cf6ce5ac4c2e6a8aed2346c595e75435db3995ca82dcc2027f0e1e1905df395
MD5 1d8d215f4aa5e9a1c11a3265b629a94c
BLAKE2b-256 15ef3fcf64366a7aca655e991e7847071496081648886fa8cdfbbd7c4b499829

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f58309d4ce645e799761518fa0ea17e71d1e265baa88c3116e47c3bbdda38031
MD5 1660e05899c7b2652c3e74d7f0a234b3
BLAKE2b-256 1490d8514867ad00f74f28f4608fab3f15ffe788b44bd0350951f527672cbb82

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-musllinux_1_2_aarch64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90d6bec4f45099f232da3acf8531c595d233991a0a69c3f39e25f2be9789f9c8
MD5 b781fe6384270c4ea51b0a1635069cb4
BLAKE2b-256 1d76252f2945bd4be8ec4e3e835c5b30ce950f541c36fc290a34c0442c664ba4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c645e8043d71a876d66ee4906415dc9ce51a49ca83d6ec78fc3b3d5f6105b0f
MD5 cc47319b453f3a3f6fdf27cb598f311a
BLAKE2b-256 a089f674af09b4cac739f2db704edc3caccb7fbeaa5de37df49c5663120ba39b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 015724ae1611edcf6027dc816ffcb10bdfda4342ed74dc603985d0e83b10f8e8
MD5 06c3dd6290bd7fb18543528094f92900
BLAKE2b-256 a8ea450ec1c165a69a2d8f23db9f6214e5d169a3d0da2a90d007f8dc9a8693be

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mint_ai-0.0.8-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for mint_ai-0.0.8-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 24c3a6e302280b32b90c70c1f40e20a59448e5cbcb9c0f69d2d5350d38c9f297
MD5 28b3d0b4595770da94d22cadfb40f1e2
BLAKE2b-256 a3e0b649a188ee7ec31d3151c49a3ce0d28d030c3d77be5d62e3a3162496ddc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mint_ai-0.0.8-py3-none-macosx_10_9_x86_64.whl:

Publisher: publish-pypi.yml on min0625/mint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page