Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦊 Mizuki Translate

Mizuki Translate is a local Translation web app that levarates LLMs to provide natural and good-sounding translation.

Features

  • Translate into 13 presets or enter any custom target language
  • Choose between a thorough standard mode and a faster mode
  • Verify names, idioms, and cultural references with web search in standard mode
  • See response time and token usage after each translation
  • Copy completed translations to the clipboard
  • Run the React frontend and FastAPI backend locally with one command

How it works

React + Vite UI  ── POST /api/translate ──▶  FastAPI  ──▶  Claude
 localhost:5173                              127.0.0.1:8000

The frontend proxies /api requests to the FastAPI backend during development. The backend applies the translation prompt in backend/prompts/TranslatePrompt_v2.md and sends the request to claude-sonnet-5 through the Anthropic API.

Translation modes

Mode Best for Behavior
standard (default) Accuracy and difficult context Uses adaptive thinking and up to two web searches to verify uncertain references
fast Lower latency Disables adaptive thinking and web search

Standard mode may take longer and consume more tokens. Both modes use the same translation prompt.

Quick start

Prerequisites

1. Configure the API key

Copy the example environment file at the repository root:

# Windows
Copy-Item .env.example .env
# macOS / Linux
cp .env.example .env

Then add your key to .env:

ANTHROPIC_API_KEY="sk-ant-..."

2. Launch the app

# Windows
.\launch.ps1
# macOS / Linux
chmod +x launch.sh
./launch.sh

The launcher installs the backend and frontend dependencies, starts the API at http://127.0.0.1:8000, and runs the Vite development server. Open the URL printed by Vite—normally http://localhost:5173.

Press Ctrl+C to stop the frontend and backend.

Run each service manually

From the repository root, start the backend:

uv sync --project backend
uv run --project backend python backend/main.py

In a second terminal, start the frontend:

npm --prefix frontend install
npm --prefix frontend run dev

Useful frontend commands:

npm --prefix frontend run build   # Type-check and create a production build
npm --prefix frontend run lint    # Run Oxlint
npm --prefix frontend run preview # Preview the production build locally

Project structure

MizukiTranslate/
├── backend/
│   ├── main.py          # FastAPI application and translation endpoint
│   ├── functions.py     # Anthropic request and error handling
│   ├── logger.py        # Loguru configuration
│   ├── prompts/         # Translation prompt templates
│   ├── pyproject.toml   # Python project and dependencies
│   └── uv.lock          # Locked Python dependencies
├── frontend/
│   ├── src/App.tsx      # Translation interface
│   ├── src/index.css    # Application styles
│   ├── vite.config.ts   # Vite config and API proxy
│   └── package.json     # Frontend scripts and dependencies
├── .env.example         # Environment variable template
├── launch.ps1           # Windows launcher
└── launch.sh            # macOS/Linux launcher

Troubleshooting

  • uv or npm is not recognized: install the missing prerequisite, open a new terminal, and confirm it is on your PATH.
  • ANTHROPIC_API_KEY is missing: make sure .env is in the repository root and contains a valid key.
  • Port 8000 or 5173 is already in use: stop the process using that port, then run the launcher again.
  • The UI opens but translation fails: check the backend terminal for the provider's error message and confirm that your Anthropic account has API access and available credits.

License

Licensed under the GNU General Public License v3.0.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages