Skip to content

diehe/local-llm-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local LLM Translator

用你的本地大模型翻译网页 — Translate web pages using your local LLM

A Chrome extension (Manifest V3) that translates entire web pages through a local large language model. Supports both OpenAI-compatible and Anthropic API formats.

Features

  • Full-page translation — batch-translates text content on any web page
  • Local LLM support — works with Ollama, vLLM, LocalAI, or any OpenAI/Anthropic-compatible API
  • Micro-batch streaming — translates in small batches (configurable), showing results progressively
  • Original text restoration — one-click revert to original page content
  • Thinking block removal — automatically strips "Thinking Process" reasoning blocks from model output
  • Dark theme UI — clean, modern popup interface

How It Works

  1. Popdown icon opens the configuration popup
  2. Click "Translate Page" — the content script collects visible text, sends it in batches to your local LLM API, and replaces text nodes with translations
  3. Click "Restore Original" — reverts all translated text back to the original

Installation

  1. Download or clone this repository
  2. Open Chrome and go to chrome://extensions
  3. Enable Developer mode (toggle in top-right)
  4. Click Load unpacked and select the extension directory
  5. The extension icon appears in your toolbar

You can also pin the extension to your toolbar for quick access.

Configuration

Setting Description Default
API Endpoint Your LLM server URL http://192.168.3.200:8000
API Key Authentication key for your LLM API
API Format OpenAI or Anthropic format openai
Model Model name to use Huihui-Qwen3.5-35B-A3B-abliterated-mxfp4
Target Language Language to translate into 中文
Source Language Original page language English
Batch Size Texts per API call (1–30) 10

API Format Support

  • OpenAI (/v1/chat/completions) — compatible with Ollama, vLLM, LocalAI, LiteLLM, and most local LLM servers
  • Anthropic (/v1/messages) — for Anthropic API or compatible proxies

Usage

  1. Click the extension icon in your toolbar
  2. Configure your LLM endpoint and settings
  3. Navigate to the web page you want to translate
  4. Open the popup and click Translate current page
  5. Translations appear progressively as batches complete
  6. Click Restore original to revert

The extension automatically:

  • Skips code blocks, scripts, SVGs, and form elements
  • Detects CJK characters to avoid re-translating already Chinese text
  • Removes model reasoning output ("Thinking Process" blocks)

Security

  • Your API key is stored locally in chrome.storage.local
  • All translation requests go directly to your configured local endpoint
  • No data is sent to external servers

License

MIT

About

A Chrome extension that translates web pages using your local LLM (OpenAI/Anthropic compatible API)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors