369 字
2 分钟
Automated Translation for Hexo Blogs with Large Language Models
TIP

The project is open-sourced on GitHub. You can visit Tokisaki-Galaxy/hexo-translate-llm for more information.

Cross-language information dissemination is increasingly important in the digital age. Manually translating articles is not only time-consuming but also hard to keep up with the update frequency. The Hexo LLM Translate plugin provides an automated solution for this. It uses large language models (LLMs) to deliver high-quality translation of blog content.

Core features#

Smart bilingual switching improves the reading experience. The plugin detects the browser’s language preference, so readers can read the matching version without manually clicking anything.

The caching mechanism ensures translation efficiency. The plugin identifies changes via content hashes, and only triggers API calls when the body or title changes. This effectively reduces API usage costs.

Multi-device sync supports a remote database. Through Neon PostgreSQL, build caches can be shared in real time between different devices. (Optional)

Stability is at the core of the plugin’s design. A built-in rate limiter prevents the API from tripping under excessive concurrency. An automatic retry mechanism effectively handles network fluctuations.

SEO optimization ensures search rankings are preserved. The translated content is injected directly into the HTML structure, allowing search engines to fully crawl the bilingual information. Hexo-specific tags are also properly protected to avoid breaking the page structure.

For articles you don’t want translated, you can exclude them by setting no_translate: true in the Front-matter.

Quick start#

Install the plugin#

Run the install command in the Hexo root directory:

Terminal window
npm install hexo-translate-llm

Configuration#

Add the following configuration to _config.yml. It’s recommended to choose a more cost-effective model:

llm_translation:
enable: true
model: deepseek-ai/DeepSeek-V3.2
endpoint: https://api.siliconflow.cn/v1/chat/completions
max_concurrency: 4
single_timeout: 120
NOTE

If you don’t want to use a remote database, you can skip the Neon PostgreSQL configuration step. The plugin will automatically use the local cache.

Security settings#

This project manages sensitive information via environment variables.

Vercel deployment#

In the project settings on the Vercel dashboard, add the LLM_API_KEY environment variable. Set up a Storage connection to connect to the neon PostgreSQL database. Vercel will automatically inject the DATABASE_URL environment variable.

Local build#

Create a .env file in the root directory:

LLM_API_KEY=您的密钥
DATABASE_URL=数据库连接地址

Usage tips#

Specific articles can be excluded from translation. Just set no_translate: true in the Front-matter. The plugin automatically syncs the page’s title tag to keep the browser tab’s language consistent.

Automated Translation for Hexo Blogs with Large Language Models
https://tski.uk/blog/en/hexo-translate-llm/
作者
Tokisaki Galaxy
发布于
2026-01-05
许可协议
CC BY