Skip to content

About

Free DeepL API for Serverless

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

172 Commits

Folders and files

Repository files navigation

DeepLX Serverless

Repository

DeepLX Serverless是一个基于DeepL网页版且无需(账号)令牌的轻量化NodeJS项目,完全使用JavaScript编写代码,这意味着您无需重新编译或打包,只需要安装依赖包即可开始运行!

Prerequisites | 准备工作

  • 支持 Nodejs ≥22 或 Docker 或 Serverless Function 的服务器/设备
  • (可选) 拥有Vercel的账号

Deploy | 部署

Deploy with Vercel

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

配置可编辑.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

启动参数会覆盖.env

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

npm run start -- -c

Note

💡使用-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)
.then(result => {
  console.log(result)
});

Star History | 收藏趋势

Star History Chart

Contribute | 贡献

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

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

Thanks | 感谢

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

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

Disclaimer | 免责声明

本项目并非DeepL官方产品,亦与其无任何从属关系。

请勿依赖本项目,由于基于DeepL网页版开发,因接口及协议变动可能导致随时罢工。如果您有大量内容需要翻译,请使用DeepL官方翻译API,DeepLXS始终受到DeepL网页版政策限制。

About

Free DeepL API for Serverless

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages