Overseas access: www.kdjingpai.com
Bookmark Us

DeepLX is a serverless (Serverless) application deployed on Cloudflare Workers that provides users with a free and high-performance interface to DeepL and Google Translate services. The project effectively solves the HTTP 429 (too many requests) error that is common when using traditional translation APIs through intelligent proxy routing, advanced rate-limiting algorithms, and a meltdown mechanism. Compared to the official API, DeepLX provides higher request rate limiting and lower network latency. Since it is completely free, with no API key or license fees, users have unlimited access to translation features with a single deployment. The program also features high stability and a variety of security features, aiming to provide a reliable, low-cost translation solution for developers and general users.

Reference project: https://github.com/OwO-Network/DeepLX

Function List

  • Multi-translation service support: Also supports DeepL (/deepl) and Google Translate (/google) two mainstream translation engines.
  • high performance: Global Edge Network deployment based on Cloudflare Workers for low-latency and zero-cold-start responsiveness.
  • High request level: Supports higher concurrent requests than the official API through intelligent load balancing and multiple proxy endpoints.
  • high stability:: With a fusion mechanism and an exponential back-off retry strategy that automatically detects and switches failed proxy endpoints, almost completely avoiding 429 errors to ensure service continuity.
  • Smart Cache: Built-in dual-layer caching system of memory and KV storage can effectively reduce repeated translation requests for the same content and improve efficiency.
  • Totally free: No need to apply for an API key, no subscription fees and no usage limits.
  • safety: Features such as input validation, multi-dimensional rate limiting, CORS support, and security headers ensure a secure and reliable service.
  • Easy to integrate: Provides detailed API documentation and usage examples in multiple programming languages (cURL, JavaScript, Python) for easy integration into various applications.

Using Help

DeepLX offers two ways to use it: directly with the author's pre-deployed public service address, or users can take matters into their own hands and deploy it to their Cloudflare accounts.

1. Quick start (use of public services)

For most users, directly using officially provided public services is the easiest and fastest way.

Public Service Addresshttps://dplx.xi-xu.me

You can invoke the translation function by sending a POST request to the appropriate path.

code example

Request headers need to be specified when requesting Content-Type: application/json, and include the text to be translated, the source language and the target language in the request body.

cURL Example.

  • Translated using DeepL (recommended).
curl -X POST https://dplx.xi-xu.me/deepl \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"source_lang": "EN",
"target_lang": "ZH"
}'
  • Using Google Translate.
curl -X POST https://dplx.xi-xu.me/google \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"source_lang": "EN",
"target_lang": "ZH"
}'

JavaScript Example.

async function translateWithDeepL(text, sourceLang = 'auto', targetLang = 'zh') {
const response = await fetch('https://dplx.xi-xu.me/deepl', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: text,
source_lang: sourceLang,
target_lang: targetLang
})
});
const result = await response.json();
return result.data;
}
// 调用示例
translateWithDeepL('Hello, world!', 'en', 'zh')
.then(result => console.log(result))
.catch(error => console.error(error));

Python Example.

import requests
import json
def translate_with_deepl(text, source_lang='auto', target_lang='zh'):
url = 'https://dplx.xi-xu.me/deepl'
data = {
'text': text,
'source_lang': source_lang,
'target_lang': target_lang
}
response = requests.post(url, json=data)
result = response.json()
if result['code'] == 200:
return result['data']
else:
raise Exception(f"Translation failed: {result.get('message', 'Unknown error')}")
# 调用示例
try:
result = translate_with_deepl('Hello, world!', 'en', 'zh')
print(result)
except Exception as e:
print(f"Error: {e}")

2. Integration with third-party tools

DeepLX can be easily integrated into many mainstream translation or academic tools. The following is a list of how to configure some commonly used tools:

  • Pot (Cross-platform stroke translation software)
    1. Download and install Pot.
    2. Go to the Pot's Service Settings.
    3. Configure the DeepL service type to DeepLXand set the custom URL to https://dplx.xi-xu.me/deeplThe
  • Zotero (documentation management tool)
    1. Install Zotero.
    2. Download and install the Translate for Zotero plugin.
    3. Under the Translations tab of your Zotero settings, configure the translation service to be DeepLX (API)The
    4. Click the Configure button to set the endpoint to https://dplx.xi-xu.me/deeplThe
  • Immersive Translate (Immersive Translate browser plugin)
    1. After installing the plugin, go to "Developer Settings" and enable Beta testing.
    2. Adding a custom translation service in Translation Services DeepLXThe
    3. Configure the API URL as https://dplx.xi-xu.me/deeplThe
    4. Set the "Maximum number of requests per second" to 80, "Maximum text length per request" is set to 5000 for optimal performance.

3. Self-deployment

If you have higher data privacy requirements or want a more stable service, you can follow the steps below to deploy DeepLX to your own Cloudflare account.

pre-conditions:

  • A Cloudflare account.
  • Node.js 18+ is installed.
  • The Wrangler CLI (command line tool for Cloudflare) is installed.

Deployment process:

  1. clone warehouse
    git clone https://github.com/xixu-me/DeepLX.git
    cd DeepLX
    
  2. Installation of dependencies
    npm install
    
  3. Configuration environment
    Open the project root directory of the wrangler.jsonc file, modify your account_id cap (a poem) name(Name of the Worker application).

    {
    "account_id": "你的CLOUDFLARE_ACCOUNT_ID",
    "name": "你的WORKER名称",
    ...
    }
    
  4. Creating a KV Namespace
    DeepLX uses KV storage for caching and rate limiting. You need to create two KV namespaces.

    # 创建缓存 KV
    npx wrangler kv:namespace create "CACHE_KV"
    
    # 创建速率限制 KV
    npx wrangler kv:namespace create "RATE_LIMIT_KV"
    

    After executing the command, the returned id Updated to wrangler.jsonc documentation kv_namespaces Part.

  5. Deploying to Cloudflare
    # 部署到生产环境
    npx wrangler deploy
    

    After a successful deployment, you will get a DeepLX service address of your own.

application scenario

  1. Personal and Developer Translation Tools Integration
    Users can integrate DeepLX as a back-end service into applications, scripts, or bots they develop to enable free text translation capabilities, such as chatbots, content aggregators, and more.
  2. Academic research and document reading
    For students and researchers who need to read a lot of foreign language literature, DeepLX can be integrated into Zotero, PDF translation tools (such as PDFMathTranslate) and other software to realize the function of one-click translation of PDF documents and academic papers.
  3. Cross-platform desktop applications
    DeepLX can be used as a back-end API to provide support for cross-platform desktop translation software such as Pot, Bob, etc., so that users can easily translate text on their computers at any time.
  4. Browser Web Translation
    Through the use of the Immersive Translate By configuring the DeepLX service address in browser plug-ins, users can get a smooth and free bilingual translation experience when browsing foreign language websites.

QA

  1. Why do I still get the HTTP 429 (too many requests) error when using it?
    This may be due to incorrect or insufficient proxy endpoint configuration. Please check the PROXY_URLS Environment variables are set correctly. For optimal performance, it is recommended to deploy and add as many instances of the XDPL agent as possible. Also, you can set the src/lib/config.ts file to adjust the rate-limiting configuration.
  2. What causes inaccurate translation results?
    First, make sure that the source and target language code you provided are correct. If the source language is set to auto-detect (AUTO), make sure that the text entered is long enough for the service to recognize it accurately. In addition, the format in which the text is encoded may also affect the quality of the translation.
  3. What if self-deployment fails?
    Deployments usually fail for several reasons: first, check that your Cloudflare account ID is in the wrangler.jsonc file is filled out correctly; second, verify that you have created the CACHE_KV cap (a poem) RATE_LIMIT_KV both KV namespaces and configure their IDs correctly; finally, make sure your network environment can access the Cloudflare service properly.
  4. What is the difference between DeepLX and the official DeepL API?
    The main differences are cost and performance. DeepL official API is paid and has strict request frequency limitations. DeepLX is completely free, and through load balancing and multi-proxy mechanisms, it provides higher request rate caps and lower latency, while ensuring service stability through intelligent retries and meltdowns.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish