mint

module
v0.0.0-alpha.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0

README ยถ

English | ็น้ซ”ไธญๆ–‡

๐ŸŒฟ Mint

Minimalist AI Translation CLI โ€” Simple. Fast. Intuitive.


Mint is a lightweight, LLM-powered translation tool for the command line. Choose your favorite LLM provider (Google Gemini, OpenAI, Anthropic, or local Ollama), and get fluent, natural translations instantly with optional smart language detection.


โœจ Why Mint?

Most translation tools are either too bloated or too locked into a specific platform. Mint is built around a single philosophy: do less, do it well.

  • Minimal โ€” One command, no noise
  • Fast โ€” Calls the LLM API directly, no intermediate layers
  • Multi-provider โ€” Choose between Google Gemini, OpenAI, Anthropic, or local Ollama models
  • Flexible โ€” Supports any language pair, freely specify your target language
  • Smart detection โ€” Optionally detect input language and auto-translate to your preference
  • Composable โ€” Pipe-friendly stdin/stdout design, fits naturally into any workflow

๐Ÿ“‹ Installation

Automated Install (One-liner)

The easiest way to install โ€” downloads the latest binary automatically:

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

Features:

  • Detects your OS and architecture automatically (Linux/macOS, x86_64/arm64)
  • Verifies SHA256 checksums
  • Installs to ~/.local/bin by default (override with MINT_INSTALL_DIR)
  • Shows PATH setup hints if needed
  • Supports pinning a specific version: MINT_VERSION=v1.0.0 bash script/install.sh
go install

If you have Go 1.21+ installed:

go install github.com/min0625/mint/cmd/mint@latest

The binary will be available as mint in your $GOPATH/bin directory (usually ~/go/bin).

Manual Download from GitHub Releases

Download pre-built binaries directly from GitHub Releases:

# Linux x86_64
curl -L https://github.com/min0625/mint/releases/latest/download/mint_Linux_x86_64.tar.gz \
  | tar xz && sudo mv mint /usr/local/bin/

# macOS arm64 (Apple Silicon)
curl -L https://github.com/min0625/mint/releases/latest/download/mint_Darwin_arm64.tar.gz \
  | tar xz && sudo mv mint /usr/local/bin/

# macOS x86_64 (Intel)
curl -L https://github.com/min0625/mint/releases/latest/download/mint_Darwin_x86_64.tar.gz \
  | tar xz && sudo mv mint /usr/local/bin/

# Windows x86_64 (PowerShell)
# Download mint_Windows_x86_64.zip from releases page and extract to a directory in your PATH
Verify Installation
mint --version

๐Ÿš€ Quick Start

1. Choose your provider
# Google Gemini (free tier available)
export MINT_PROVIDER=google-genai
export MINT_API_KEY=your_gemini_api_key
# Get a free API key at: https://aistudio.google.com/apikey

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

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

# Local Ollama (no API key needed)
export MINT_PROVIDER=ollama
export MINT_BASE_URL=http://localhost:11434
export MINT_MODEL_NAME=llama2
2. Translate with explicit target language
# Specify a target language (BCP-47 tag) using --target or -t flag
mint --target ja "Good morning"
mint -t zh-TW "Good morning"

# Pipe from stdin
echo "The quick brown fox" | mint -t fr

# Translate a file
cat document.txt | mint -t zh-TW
3. Smart language detection (optional)

Set your target language preference using MINT_TARGET_LANG:

# Single target language
export MINT_TARGET_LANG=zh-TW
mint "Good morning"    # Detects English โ†’ translates to zh-TW
mint "ๆ—ฉๅฎ‰"            # Detects Chinese โ†’ grammar & spelling correction

# Multiple target languages (language rotation)
export MINT_TARGET_LANG=en,zh-TW,ja

mint "Hello"           # English input โ†’ translates to zh-TW (next in rotation)
mint "ไฝ ๅฅฝ"            # Chinese input โ†’ translates to ja (next in rotation)
mint "ใ“ใ‚“ใซใกใฏ"     # Japanese input โ†’ translates to en (wraps around)

The tool automatically detects the input language and applies the appropriate transformation.


๐Ÿ”‘ Environment Variables

Variable Description Required Default
MINT_PROVIDER LLM provider: google-genai, openai, anthropic, ollama Yes โ€”
MINT_API_KEY API key for the chosen provider Conditional* โ€”
MINT_BASE_URL Custom API endpoint; required for ollama (e.g., for self-hosted or local services) Conditional* Provider default
MINT_MODEL_NAME LLM model name to use Optional Provider default**
MINT_TARGET_LANG Target language(s) - single or comma-separated (e.g. en, en,zh-TW,ja) Optional System locale or en

Conditional: MINT_API_KEY required for google-genai, openai, anthropic; not needed for ollama. MINT_BASE_URL required for ollama. Default models: google-genai: gemini-3.1-flash-lite, openai: gpt-4o-mini, anthropic: claude-haiku-4-5; ollama: none (must specify).

Language Resolution Priority

The tool uses the following priority order to determine the target language(s):

  1. Flag: --target / -t CLI flag (highest priority)
  2. Config: MINT_TARGET_LANG environment variable
  3. System: Operating system locale
  4. Default: en (lowest priority)

๐ŸŽฏ Design Principles

Mint follows the Unix philosophy โ€” do one thing, and do it well.

Principle Description
Zero-dependency install Single binary, works out of the box
Multi-provider Supports major LLM services plus local alternatives
Composability Pairs seamlessly with grep, sed, xargs, and friends
Transparent output Results go to stdout, errors go to stderr
Environment-friendly API keys managed via environment variables, no config file pollution

๐Ÿ—บ Roadmap

  • Multi-LLM provider support (Google Gemini, OpenAI, Anthropic, Ollama)
  • Smart language detection and multi-language rotation via MINT_TARGET_LANG
  • Explicit target language via --target / -t flag
  • 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 file for details.

Directories ยถ

Path Synopsis
cmd
mint command
internal
provider
Package provider manages LLM provider configuration and initialization.
Package provider manages LLM provider configuration and initialization.
provider/anthropic
Package anthropic provides Anthropic Claude LLM client for text translation.
Package anthropic provides Anthropic Claude LLM client for text translation.
provider/googlegenai
Package googlegenai provides Google Gemini LLM client for text translation.
Package googlegenai provides Google Gemini LLM client for text translation.
provider/ollama
Package ollama provides Ollama local LLM client for text translation.
Package ollama provides Ollama local LLM client for text translation.
provider/openai
Package openai provides OpenAI GPT LLM client for text translation.
Package openai provides OpenAI GPT LLM client for text translation.
translator
Package translator defines the Translator interface for LLM translation backends.
Package translator defines the Translator interface for LLM translation backends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL