Home
Softono

DeepLX Serverless

Open source MIT JavaScript
558
Stars
162
Forks
2
Issues
5
Watchers
1 year
Last Commit

 About DeepLX Serverless

Free DeepL API for Serverless

Platforms

Web Self-hosted

Languages

JavaScript

Links

Need Help Installing DeepLX Serverless?

We provide expert installation service for this software. Our team will install, configure, and secure DeepLX Serverless on your server. plans start at just $30.

DeepLX Serverless

View on GitHub

DeepLX Serverless

Repository

DeepLX Serverless是一个基于DeepL翻译网页版且无需令牌的Serverless版本,与原项目DeepLX的区别在于利用了无服务器函数(边缘函数)请求IP不固定的特性,有效避免了Error 429(不过嘛凡事总有例外¯\_(ツ)_/¯)

3.0版本开始完全基于OwO-Network/DeepLX和DeepL网页版数据进行重写。
2.0及之前版本在LegendLeo/deeplx-serverless的基础上进行重构。

Prerequisites | 准备工作

[!IMPORTANT] 有时main分支的合并可能不及时,或者你希望提前体验新功能,请切换到dev分支获取代码。

  • 支持 Nodejs ≥18DockerServerless Function 的服务器
  • (可选) 拥有Vercel的账号

Deploy | 部署

Deploy with Vercel

git clone https://github.com/guobao2333/DeepLX-Serverless
cd DeepLX-Serverless
npm i
npm run start

配置可编辑.env或者提供启动参数来修改。

Docker | 容器部署

🐳预构建:

docker run -d -p 6119:6119 ghcr.io/guobao2333/deeplx-serverless

自行构建:

docker build -t deeplxs .
docker run -d -p 6119:6119 deeplxs

Startup Parameters | 启动参数

[!IMPORTANT] 此功能在 2.0.0 及以上版本中可用。
启动参数会覆盖.env

有时你可能想在启动服务时添加参数。
比如添加一个-c参数来允许所有跨域请求:

npm run start -- -c

💡使用-h来获取所有参数。

How To Use | 如何使用

Http Call | 网络请求

curl -X POST 'http://localhost:6119/translate' -H 'Content-Type: application/json' -d '{"text": "你好,世界!", "source_lang": "zh", "target_lang": "en"}'

Internal Call | 集成使用

运行npm test来测试翻译接口。还可以集成到你的项目中来使用DeepL翻译服务。

简单的示例:

import { translate } from './src/translate.js';
translate('how are you?', 'en', 'zh', '', false, false)
.then(result => {
  console.log(result)
});

Star History | 收藏趋势

Star History Chart

Contribute | 贡献

  1. 获取devmain分支的代码
  2. 提交你的更改并描述提交内容
  3. 创建一个Pull Requests

如果你是第一次贡献,那么请查看《如何为开源做贡献》

Thanks | 感谢

它们是本项目的根本,没有它们就没有本项目。

  1. OwO-Network/DeepLX
  2. LegendLeo/deeplx-serverless
  3. bropines/Deeplx-vercel

Disclaimer | 免责声明

请勿依赖本项目,因基于DeepL网页版数据,可能随时罢工。如果您有大量内容需要翻译,请购买DeepL官方翻译API,DeepLXS始终受到DeepL政策限制。

本项目目前处于开发状态,实现及其简陋,部分功能已编写文档不代表已实现。