guobao2333/DeepLX-Serverless

Free DeepL API for Serverless

What it is

DeepLX Serverless is a lightweight Node.js project that provides a translation service using DeepL's web interface, without needing an API key or account token. It's written entirely in JavaScript, so no compilation or bundling is required—just install dependencies and run.

How it works

The project is built on the Hono framework, which lets it run on multiple JavaScript runtimes (Node, Bun, Deno) and serverless platforms like Vercel. Recent versions have moved away from Node-specific APIs toward standard Web APIs, making it more portable. It exposes an HTTP endpoint (/translate) that accepts JSON with text and language codes, and returns the translation.

Deployment

  • Vercel: One-click deploy button is provided.
  • Local runtimes: Clone the repo, then install and run per platform:
    • Node: npm install then npm run start:node
    • Bun: bun install then bun run start:bun
    • Deno: deno task start:deno (no install step)
  • Docker: Pre-built image ghcr.io/guobao2333/deeplx-serverless or build your own with the included Dockerfile. Both run on port 6119.

Configuration

Settings can be changed via a .env file or command-line arguments. Arguments override .env. For example:

  • -c allows all cross-origin requests
  • -p6666 changes the port to 6666
  • -h shows all available options

Usage

  • HTTP call: Send a POST request to /translate with JSON like {"text": "你好,世界!", "source_lang": "zh", "target_lang": "en"}.
  • As a module: The translate.js file is standalone and can be imported into your own project. Example:
    import { translate } from './src/translate.js';
    translate('how are you?', 'en', 'zh', false)
      .then(result => console.log(result))
      .catch(err => console.error(err));
    
  • Run npm test to test the translation endpoint.

Important notes

  • This is not an official DeepL product and has no affiliation with DeepL.
  • Because it relies on DeepL's web interface, it may stop working if DeepL changes its protocols or policies.
  • For large-scale or production use, the README recommends using DeepL's official API instead.

Credits

The project acknowledges prior work from OwO-Network/DeepLX, LegendLeo/deeplx-serverless, and bropines/Deeplx-vercel.

Contributing

Contributions are welcome: fork the main branch, submit changes with a description, and create a pull request. First-time contributors are pointed to the open-source contribution guide.

Star history

The README includes a star-history chart, but no further details are given.

Related

  • Project
  • Project
  • Project
  • Project
  • Project